diff --git a/README.rdoc b/README.rdoc index 38aff0cef..0ead19ef2 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,4 +1,4 @@ -= Notebook.ai += Notebook.ai {Build Status}[https://travis-ci.org/indentlabs/notebook] {}[https://codeclimate.com/github/indentlabs/notebook] {}[https://codeclimate.com/github/indentlabs/notebook/coverage] diff --git a/app/assets/images/logos/paper-original.png b/app/assets/images/logos/paper-original.png new file mode 100644 index 000000000..ae8a6b45a Binary files /dev/null and b/app/assets/images/logos/paper-original.png differ diff --git a/app/assets/stylesheets/paper.scss b/app/assets/stylesheets/paper.scss new file mode 100644 index 000000000..f6c7fc6cd --- /dev/null +++ b/app/assets/stylesheets/paper.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the Paper controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: https://sass-lang.com/ diff --git a/app/assets/stylesheets/pdf.css b/app/assets/stylesheets/pdf.css new file mode 100644 index 000000000..27dba48c6 --- /dev/null +++ b/app/assets/stylesheets/pdf.css @@ -0,0 +1,28 @@ +/* Pagebreak stuff */ +div.alwaysbreak { page-break-before: always; } +div.nobreak:before { clear:both; } +div.nobreak { page-break-inside: avoid; } + +/* Text styling */ +.center { text-align: center; } +.centered { margin: 0 auto; } +.text-right { text-align: right; } +.uppercase { text-transform: uppercase; } + +.grey-text { color: rgb(105, 105, 105); } + +/* Text hierarchy */ +.category-name { font-size: 1.2em; margin-top: 1em; margin-bottom: 0.75em; font-weight: bold;} +.field-name { font-size: 1.1em; } + +/* Structure */ +.skip-quarter-page { padding-top: 250px; } +.skip-third-page { padding-top: 330px; } +.skip-half-page { padding-top: 470px; } + +/* Inputs */ +.underlined { border-bottom: 1px solid black; min-width: 100px; min-height: 2.5em; } +.quarter-page-width { width: 225px; } +.third-page-width { width: 300px; } +.half-page-width { width: 450px; } +.two-thirds-page-width { width: 600px; } diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index bbee013a0..5eb8b946f 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -29,6 +29,9 @@ def dashboard @attribute_field_to_question = SerendipitousService.question_for(@content) end + def paper + end + def infostack end diff --git a/app/controllers/paper_controller.rb b/app/controllers/paper_controller.rb new file mode 100644 index 000000000..84d767604 --- /dev/null +++ b/app/controllers/paper_controller.rb @@ -0,0 +1,71 @@ +class PaperController < ApplicationController + def index + end + + def generate + pages_to_include = [ + ["Cover", 1], # Notebook Paper cover page + ["Owner", 1], # "If lost, contact X page" + [Universe.name, 1], # single Universe page + ] + pages_to_include.concat paper_params.keys.map { |page_type, page_count| [page_type, 2] } + pages_to_include.push ["Notebook.ai", 1] # Page talking about Notebook.ai <3 + + pdf = generate_pdf(pages_to_include) + render_pdf(pdf) + end + + def individual + page_type = params.fetch(:page_type) + raise "Invalid page type: #{page_type}" unless Rails.application.config.content_types[:all].map(&:name).include?(page_type) + + pages_to_include = [ + [page_type, 1] + ] + + pdf = generate_pdf(pages_to_include) + render_pdf(pdf, filename="Notebook-#{page_type}.pdf") + end + + private + + def generate_pdf(page_quantity_mapping) + # Build a gigantic HTML model of all the page contents + concatenated_pdf_html = '' + page_quantity_mapping.each do |page_template, page_count| + page_html = ActionController::Base.new.render_to_string(template: "paper/templates/#{page_template.downcase}", layout: nil) + page_count.times do |i| + # Add a manual pagebreak + concatenated_pdf_html += "
" + + # Append the page template + concatenated_pdf_html += page_html + end + end + + # Wrap the page contents in the global pdf layout + formatted_pdf = ActionController::Base.new.render_to_string(template: "layouts/pdf", layout: nil) + formatted_pdf.gsub!('', concatenated_pdf_html) + + # Debugging: + # render html: formatted_pdf.html_safe + + # Create the PDF and return it + WickedPdf.new.pdf_from_string(formatted_pdf) + end + + def render_pdf(pdf, filename='Notebook.pdf') + send_data( + pdf, + filename: filename, + type: "application/pdf", # Uncommenting these lets us render the PDF in-browser instead of downloading + disposition: "inline" # "" + ) + end + + def paper_params + params.require(:paper) + .permit(*Rails.application.config.content_types[:all_non_universe].map(&:name)) + .reject { |klass, boolean| boolean == "0" } + end +end diff --git a/app/helpers/paper_helper.rb b/app/helpers/paper_helper.rb new file mode 100644 index 000000000..374596132 --- /dev/null +++ b/app/helpers/paper_helper.rb @@ -0,0 +1,2 @@ +module PaperHelper +end diff --git a/app/views/layouts/pdf.html.erb b/app/views/layouts/pdf.html.erb new file mode 100644 index 000000000..ac532a788 --- /dev/null +++ b/app/views/layouts/pdf.html.erb @@ -0,0 +1,13 @@ + + + + + <%= wicked_pdf_stylesheet_link_tag "pdf" %> + + + +
+ +
+ + diff --git a/app/views/paper/generate.html.erb b/app/views/paper/generate.html.erb new file mode 100644 index 000000000..c821de718 --- /dev/null +++ b/app/views/paper/generate.html.erb @@ -0,0 +1,2 @@ +

Paper#generate

+

Find me in app/views/paper/generate.html.erb

diff --git a/app/views/paper/index.html.erb b/app/views/paper/index.html.erb new file mode 100644 index 000000000..3c5905b8b --- /dev/null +++ b/app/views/paper/index.html.erb @@ -0,0 +1,155 @@ +
+ <% 2.times do %>
<% end %> + +
Introducing...
+ <%= image_tag 'logos/paper-original.png', width: '100%' %> + +
+

Create rich worlds — and everything within them!

+

+ You know that <%= link_to 'smart worldbuilding notebook', 'https://www.notebook.ai' %> you've been building fictional universes + in for + <%= link_to 'over four years', 'https://medium.com/indent-labs/happy-4th-birthday-to-notebook-ai-e6f69f06d169' %> + now? Well, Notebook Paper is kind of like that, except real paper. You can feel it, touch it — even smell it! + And best of all, it comes with all the benefits inherent to a more physical form: +

+ + + +

+ Rather than loading up Notebook.ai the next time you get an idea for a character, consider giving Notebook Paper a shot. + It's easy to get started: just print out your notebook pages and you're good to go! You can jot down freeform notes or + outline structured details about your idea. You can even doodle and write notes in the margins! +

+ +

+ If you don't have an idea in mind already, you can use Notebook Paper anyway. Every page comes with a set of questions tailored to ask about the world you're + creating and make worldbuilding fun and easy. +

+

+ For example, character pages ask for a name — of course — but also how they look, what they believe + in, what motivates them, where they came from, and a myriad of other easily-answered questions that are fun to answer and develop your characters little by + little. And there are different questions for coming up with locations, items, creatures, and so on. +

+ +

+ Notebook Paper makes worldbuilding fun and easy — like Notebook.ai, but physical! +

+ +

+ +
+
+
+
face
+

<%= t('marketing.landing_page.benefits.characters.title') %>

+

+ <%= t('marketing.landing_page.benefits.characters.text') %> +

+
+
+ +
+
+
public
+

<%= t('marketing.landing_page.benefits.locations.title') %>

+

+ <%= t('marketing.landing_page.benefits.locations.text') %> +

+
+
+ +
+
+
security
+

<%= t('marketing.landing_page.benefits.ads.title') %>

+

+ It kind of feels like Notebook.ai, but paper. There's no ads on the site, why would we add ads to paper? +

+
+
+
+ +

Fill your world with all kinds of specialized pages

+

+ Notebook Paper includes all of Notebook.ai's free and Premium pages — for free! +

+

+ Specialized pages are available for + <%= + Rails.application.config.content_types[:all_non_universe].map { |content_type| + link_to content_type.name.pluralize, send("#{content_type.name.downcase}_worldbuilding_info_path"), class: "#{content_type.color}-text" + }.to_sentence.html_safe + %>. +

+

+ Just select which ones you want, print out your personalized PDF, and you're ready to get started! +

+
+ +
+
+
+
Start with a customized Notebook Paper download
+ <%= form_for :paper, url: generate_paper_path do |f| %> +
+ <% Rails.application.config.content_types[:all_non_universe].each do |content_type| %> +
+
+ <%= f.label content_type.name do %> + <%= f.check_box content_type.name %> + + <%= content_type.icon %> + Include 2 <%= content_type.name %> pages + + <% end %> +
+
+ <% end %> +
+ +
+ <%= f.submit 'Generate Notebook Paper', class: 'btn btn-large blue white-text hoverable'%> +
+ +
+

+ Please note that while you can select every page, the resulting generated document will + be extremely large (over 300 pages) and up to 1MB in size. It's recommended to choose only the + pages you plan to start with, then download more pages as needed from below. +

+ <% end %> +
+
+
+ +
+

Fill your Notebook Paper with more pages

+

+ You can always come back here for more of your favorite worldbuilding pages. Each of the + buttons below will generate more Notebook Paper for each piece of your world. + Simply print the resulting PDF out as many times as you want and add those pages to your + Notebook Paper to keep growing your world however you want — at your pace! +

+
+ + <% Rails.application.config.content_types[:all].each do |content_type| %> +
+ <%= link_to generate_individual_paper_path(content_type.name + '.pdf') do %> +
+
+ <%= image_tag asset_path("card-headers/#{content_type.name.downcase.pluralize}.jpg"), height: 185 %> +
+
+ <%= content_type.icon %> + <%= content_type.name %> +
+
+ <% end %> +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/paper/templates/_content_page.html.erb b/app/views/paper/templates/_content_page.html.erb new file mode 100644 index 000000000..1362ff3b1 --- /dev/null +++ b/app/views/paper/templates/_content_page.html.erb @@ -0,0 +1,55 @@ +
+
<%= content_name.titleize %> name
+<%= content_name.titleize.constantize.icon %> +

+ +<% + YAML.load_file(Rails.root.join('config', 'attributes', "#{content_name}.yml")).map do |category_name, defaults| + next if %i(contributors gallery changelog).include?(category_name) +%> + <% seen_fields = [] %> + <% defaults[:attributes].each.with_index do |field, index| %> +
+ <%# + We inject the category titles in the first field's nobreak (instead of before the loop) + to make sure we never have a situation where a category title ends the page and then + the first field is on the next page. Instead, we want to make sure the category title + gets clumped with AT LEAST one field on the same page, and this is the best way to do it. + %> + <% if index === 0 %> +
<%= category_name.to_s.titleize %>
+ <% end %> + + <% + # Exclude fields that don't make sense + next if [ + "name", "tags", "private notes", "linked races", "universe" + ].include?(field[:label].downcase) + + # Make sure we don't have any duplicate fields + next if seen_fields.include?(field[:label].downcase) + seen_fields.push field[:label].downcase + %> + + <% prompt = I18n.translate "attributes.#{content_name}.#{field[:label].downcase.gsub(/\s/, '_')}", + scope: :serendipitous_questions, + name: "this #{content_name}", + default: '' + %> + +
+ <%= field[:label] %> + <% unless prompt.empty? %> + - <%= prompt %> + <% end %> +
+ <% 4.times do %>
<% end %> + <% if field[:label] == 'Notes' %> + <% 4.times do %>
<% end %> + <% end %> +
+
+ <% end %> +<% + end +%> diff --git a/app/views/paper/templates/building.html.erb b/app/views/paper/templates/building.html.erb new file mode 100644 index 000000000..c7bd8c4c7 --- /dev/null +++ b/app/views/paper/templates/building.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'building' } %> diff --git a/app/views/paper/templates/character.html.erb b/app/views/paper/templates/character.html.erb new file mode 100644 index 000000000..a2a4849af --- /dev/null +++ b/app/views/paper/templates/character.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'character' } %> diff --git a/app/views/paper/templates/condition.html.erb b/app/views/paper/templates/condition.html.erb new file mode 100644 index 000000000..cbb6d985e --- /dev/null +++ b/app/views/paper/templates/condition.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'condition' } %> diff --git a/app/views/paper/templates/continent.html.erb b/app/views/paper/templates/continent.html.erb new file mode 100644 index 000000000..4d46c1bc9 --- /dev/null +++ b/app/views/paper/templates/continent.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'continent' } %> diff --git a/app/views/paper/templates/country.html.erb b/app/views/paper/templates/country.html.erb new file mode 100644 index 000000000..6958c6ec5 --- /dev/null +++ b/app/views/paper/templates/country.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'country' } %> diff --git a/app/views/paper/templates/cover.html.erb b/app/views/paper/templates/cover.html.erb new file mode 100644 index 000000000..dff9b3d51 --- /dev/null +++ b/app/views/paper/templates/cover.html.erb @@ -0,0 +1,5 @@ +
+

Notebook Paper

+

a smart worldbuilding notebook

+
made with Notebook.ai
+
\ No newline at end of file diff --git a/app/views/paper/templates/creature.html.erb b/app/views/paper/templates/creature.html.erb new file mode 100644 index 000000000..9ea435a86 --- /dev/null +++ b/app/views/paper/templates/creature.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'creature' } %> diff --git a/app/views/paper/templates/deity.html.erb b/app/views/paper/templates/deity.html.erb new file mode 100644 index 000000000..c8e7fbf1f --- /dev/null +++ b/app/views/paper/templates/deity.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'deity' } %> diff --git a/app/views/paper/templates/flora.html.erb b/app/views/paper/templates/flora.html.erb new file mode 100644 index 000000000..2cf84c0db --- /dev/null +++ b/app/views/paper/templates/flora.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'flora' } %> diff --git a/app/views/paper/templates/food.html.erb b/app/views/paper/templates/food.html.erb new file mode 100644 index 000000000..c32fa4635 --- /dev/null +++ b/app/views/paper/templates/food.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'food' } %> diff --git a/app/views/paper/templates/government.html.erb b/app/views/paper/templates/government.html.erb new file mode 100644 index 000000000..5ecbe55dc --- /dev/null +++ b/app/views/paper/templates/government.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'government' } %> diff --git a/app/views/paper/templates/group.html.erb b/app/views/paper/templates/group.html.erb new file mode 100644 index 000000000..f405e69d9 --- /dev/null +++ b/app/views/paper/templates/group.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'group' } %> diff --git a/app/views/paper/templates/item.html.erb b/app/views/paper/templates/item.html.erb new file mode 100644 index 000000000..1064ed1e5 --- /dev/null +++ b/app/views/paper/templates/item.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'item' } %> diff --git a/app/views/paper/templates/job.html.erb b/app/views/paper/templates/job.html.erb new file mode 100644 index 000000000..991d488f0 --- /dev/null +++ b/app/views/paper/templates/job.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'job' } %> diff --git a/app/views/paper/templates/landmark.html.erb b/app/views/paper/templates/landmark.html.erb new file mode 100644 index 000000000..6e140afbd --- /dev/null +++ b/app/views/paper/templates/landmark.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'landmark' } %> diff --git a/app/views/paper/templates/language.html.erb b/app/views/paper/templates/language.html.erb new file mode 100644 index 000000000..37372d732 --- /dev/null +++ b/app/views/paper/templates/language.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'language' } %> diff --git a/app/views/paper/templates/location.html.erb b/app/views/paper/templates/location.html.erb new file mode 100644 index 000000000..7ce0357f9 --- /dev/null +++ b/app/views/paper/templates/location.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'location' } %> diff --git a/app/views/paper/templates/lore.html.erb b/app/views/paper/templates/lore.html.erb new file mode 100644 index 000000000..c6e70df35 --- /dev/null +++ b/app/views/paper/templates/lore.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'lore' } %> diff --git a/app/views/paper/templates/magic.html.erb b/app/views/paper/templates/magic.html.erb new file mode 100644 index 000000000..2b00e7b07 --- /dev/null +++ b/app/views/paper/templates/magic.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'magic' } %> diff --git a/app/views/paper/templates/notebook.ai.html.erb b/app/views/paper/templates/notebook.ai.html.erb new file mode 100644 index 000000000..0e9237e00 --- /dev/null +++ b/app/views/paper/templates/notebook.ai.html.erb @@ -0,0 +1,24 @@ +
+

This notebook was generated at Notebook.ai on

+
+ <%= DateTime.current.strftime("%A, %B %d, %Y") %> +
+
+ +<% 5.times do %>
<% end %> + +
+

+ Conveniently, each of the categories and questions in this notebook correspond to questions that also + exist on Notebook.ai. If you'd like to back up your worlds, link pages together, search your world, + see changes over time, and share pages with others (even collaborators!), you're always welcome on + Notebook.ai. +

+


+

+ Happy worldbuilding! +

+

+ — Andrew, maker of Notebook.ai +

+
\ No newline at end of file diff --git a/app/views/paper/templates/owner.html.erb b/app/views/paper/templates/owner.html.erb new file mode 100644 index 000000000..ba55b2d1e --- /dev/null +++ b/app/views/paper/templates/owner.html.erb @@ -0,0 +1,13 @@ +
+

If found, please contact:

+
+
(name)
+
+
at
+
+
(phone)
+
+
or
+
+
(email)
+
\ No newline at end of file diff --git a/app/views/paper/templates/planet.html.erb b/app/views/paper/templates/planet.html.erb new file mode 100644 index 000000000..765fd09e3 --- /dev/null +++ b/app/views/paper/templates/planet.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'planet' } %> diff --git a/app/views/paper/templates/race.html.erb b/app/views/paper/templates/race.html.erb new file mode 100644 index 000000000..ced9247e7 --- /dev/null +++ b/app/views/paper/templates/race.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'race' } %> diff --git a/app/views/paper/templates/religion.html.erb b/app/views/paper/templates/religion.html.erb new file mode 100644 index 000000000..57bdbdec6 --- /dev/null +++ b/app/views/paper/templates/religion.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'religion' } %> diff --git a/app/views/paper/templates/scene.html.erb b/app/views/paper/templates/scene.html.erb new file mode 100644 index 000000000..42951345b --- /dev/null +++ b/app/views/paper/templates/scene.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'scene' } %> diff --git a/app/views/paper/templates/school.html.erb b/app/views/paper/templates/school.html.erb new file mode 100644 index 000000000..ce26e29ab --- /dev/null +++ b/app/views/paper/templates/school.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'school' } %> diff --git a/app/views/paper/templates/sport.html.erb b/app/views/paper/templates/sport.html.erb new file mode 100644 index 000000000..636fb5581 --- /dev/null +++ b/app/views/paper/templates/sport.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'sport' } %> diff --git a/app/views/paper/templates/technology.html.erb b/app/views/paper/templates/technology.html.erb new file mode 100644 index 000000000..80a447793 --- /dev/null +++ b/app/views/paper/templates/technology.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'technology' } %> diff --git a/app/views/paper/templates/town.html.erb b/app/views/paper/templates/town.html.erb new file mode 100644 index 000000000..a7d8e5d63 --- /dev/null +++ b/app/views/paper/templates/town.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'town' } %> diff --git a/app/views/paper/templates/tradition.html.erb b/app/views/paper/templates/tradition.html.erb new file mode 100644 index 000000000..3cd0724f3 --- /dev/null +++ b/app/views/paper/templates/tradition.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'tradition' } %> diff --git a/app/views/paper/templates/universe.html.erb b/app/views/paper/templates/universe.html.erb new file mode 100644 index 000000000..296a96454 --- /dev/null +++ b/app/views/paper/templates/universe.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'universe' } %> diff --git a/app/views/paper/templates/vehicle.html.erb b/app/views/paper/templates/vehicle.html.erb new file mode 100644 index 000000000..fc5fec016 --- /dev/null +++ b/app/views/paper/templates/vehicle.html.erb @@ -0,0 +1 @@ +<%= render partial: 'paper/templates/content_page', locals: { content_name: 'vehicle' } %> diff --git a/config/initializers/wicked_pdf.rb b/config/initializers/wicked_pdf.rb index 262cdcfa8..d8e767c24 100644 --- a/config/initializers/wicked_pdf.rb +++ b/config/initializers/wicked_pdf.rb @@ -8,12 +8,14 @@ # # https://github.com/mileszs/wicked_pdf/blob/master/README.md -WickedPdf.config = { +WickedPdf.config ||= {} +WickedPdf.config.merge!({ # Path to the wkhtmltopdf executable: This usually isn't needed if using # one of the wkhtmltopdf-binary family of gems. # exe_path: '/usr/local/bin/wkhtmltopdf', # or # exe_path: Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf') + :exe_path => Rails.root.join('vendor/bundle/bin/wkhtmltopdf-linux-amd64').to_s, # Layout file to be used for all PDFs # (but can be overridden in `render :pdf` calls) @@ -24,4 +26,4 @@ # 'xvfb-run' command, in order to simulate an X server. # # use_xvfb: true, -} +}) \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 4c5d0218c..bdb40228c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -382,5 +382,14 @@ # Promos and other temporary pages get '/redeem/infostack', to: 'main#infostack' get '/redeem/sascon', to: 'main#sascon' + + scope :paper do + get '/', to: 'paper#index' + post '/', to: 'paper#generate', as: :generate_paper + + # TODO: We probably actually just want to render these once and serve them as + # static PDFs, instead of creating a new PDF on every request. :) + get '/:page_type', to: 'paper#individual', as: :generate_individual_paper + end end # rubocop:enable LineLength diff --git a/test/controllers/paper_controller_test.rb b/test/controllers/paper_controller_test.rb new file mode 100644 index 000000000..9e09305a0 --- /dev/null +++ b/test/controllers/paper_controller_test.rb @@ -0,0 +1,14 @@ +require 'test_helper' + +class PaperControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get paper_index_url + assert_response :success + end + + test "should get generate" do + get paper_generate_url + assert_response :success + end + +end