Skip to content

Commit

Permalink
Switch to haml.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmanyhats committed Dec 30, 2024
1 parent 9174e57 commit 1024851
Show file tree
Hide file tree
Showing 21 changed files with 420 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

108 changes: 108 additions & 0 deletions .idea/pudding.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Custom bootstrap variables must be set or imported *before* bootstrap.
@import "bootstrap";
19 changes: 19 additions & 0 deletions app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
!!!
%html
%head
%meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
%title= content_for(:title) || "Pudding"
%meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
%meta{:content => "yes", :name => "apple-mobile-web-app-capable"}/
%meta{:content => "yes", :name => "mobile-web-app-capable"}/
= csrf_meta_tags
= csp_meta_tag
= yield :head
%link{:href => "/icon.png", :rel => "icon", :type => "image/png"}/
%link{:href => "/icon.svg", :rel => "icon", :type => "image/svg+xml"}/
%link{:href => "/icon.png", :rel => "apple-touch-icon"}/
= stylesheet_link_tag :app, "data-turbo-track": "reload"
= javascript_importmap_tags
= stylesheet_link_tag "application", "data-turbo-track": "reload"
%body
= yield
8 changes: 8 additions & 0 deletions app/views/layouts/mailer.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!!!
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/
:css
/* Email styles need to be inline */
%body
= yield
1 change: 1 addition & 0 deletions app/views/layouts/mailer.text.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= yield
8 changes: 8 additions & 0 deletions app/views/passwords/edit.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%h1 Update your password
= tag.div(flash[:alert], style: "color:red") if flash[:alert]
= form_with url: password_path(params[:token]), method: :put do |form|
= form.password_field :password, required: true, autocomplete: "new-password", placeholder: "Enter new password", maxlength: 72
%br/
= form.password_field :password_confirmation, required: true, autocomplete: "new-password", placeholder: "Repeat new password", maxlength: 72
%br/
= form.submit "Save"
6 changes: 6 additions & 0 deletions app/views/passwords/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
%h1 Forgot your password?
= tag.div(flash[:alert], style: "color:red") if flash[:alert]
= form_with url: passwords_path do |form|
= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address]
%br/
= form.submit "Email reset instructions"
3 changes: 3 additions & 0 deletions app/views/passwords_mailer/reset.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
%p
You can reset your password within the next 15 minutes on
\#{link_to "this password reset page", edit_password_url(@user.password_reset_token)}.
2 changes: 2 additions & 0 deletions app/views/passwords_mailer/reset.text.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
You can reset your password within the next 15 minutes on this password reset page:
= edit_password_url(@user.password_reset_token)
26 changes: 26 additions & 0 deletions app/views/pdfs/_form.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
= form_with(model: pdf) do |form|
- if pdf.errors.any?
%div{:style => "color: red"}
%h2
= pluralize(pdf.errors.count, "error")
prohibited this pdf from being saved:
%ul
- pdf.errors.each do |error|
%li= error.full_message
%div
= form.label :name, style: "display: block"
= form.text_field :name
%div
= form.label :version, style: "display: block"
= form.text_field :version
%div
= form.label :description, style: "display: block"
= form.text_field :description
%div
= form.label :pdf_file, style: "display: block"
= form.file_field :pdf_file
%div
= form.label :first_page_number, style: "display: block"
= form.text_field :first_page_number
%div
= form.submit
25 changes: 25 additions & 0 deletions app/views/pdfs/_pdf.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
%div{:id => "#{dom_id pdf}"}
%p
%strong Name:
= pdf.name
%p
%strong Owner:
= pdf.owner_id
%p
%strong Version:
= pdf.version
%p
%strong Description:
= pdf.description
%p
%strong Page count:
= pdf.page_count
%p
%strong First page numberuploaded filename:
= pdf.first_page_numberuploaded_filename
%p
%strong Uploaded at:
= pdf.uploaded_at
%p
%strong Uploaded by:
= pdf.uploaded_by_id
8 changes: 8 additions & 0 deletions app/views/pdfs/edit.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- content_for :title, "Editing pdf"
%h1 Editing pdf
= render "form", pdf: @pdf
%br/
%div
= link_to "Show this pdf", @pdf
|
\#{link_to "Back to pdfs", pdfs_path}
9 changes: 9 additions & 0 deletions app/views/pdfs/index.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
%p{:style => "color: green"}= notice
- content_for :title, "Pdfs"
%h1 Pdfs
#pdfs
- @pdfs.each do |pdf|
= render pdf
%p
= link_to "Show this pdf", pdf
= link_to "New pdf", new_pdf_path
6 changes: 6 additions & 0 deletions app/views/pdfs/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- content_for :title, "New pdf"
%h1 New pdf
= render "form", pdf: @pdf
%br/
%div
= link_to "Back to pdfs", pdfs_path
8 changes: 8 additions & 0 deletions app/views/pdfs/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
%p{:style => "color: green"}= notice
= render @pdf
%div
= link_to "Edit this pdf", edit_pdf_path(@pdf)
|
\#{link_to "Back to pdfs", pdfs_path}

\#{button_to "Destroy this pdf", @pdf, method: :delete}
22 changes: 22 additions & 0 deletions app/views/pwa/manifest.json.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Pudding",
"icons": [
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512"
},
{
"src": "/icon.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
}
],
"start_url": "/",
"display": "standalone",
"scope": "/",
"description": "Pudding.",
"theme_color": "red",
"background_color": "red"
}
10 changes: 10 additions & 0 deletions app/views/sessions/new.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
= tag.div(flash[:alert], style: "color:red") if flash[:alert]
= tag.div(flash[:notice], style: "color:green") if flash[:notice]
= form_with url: session_path do |form|
= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address]
%br/
= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72
%br/
= form.submit "Sign in"
%br/
= link_to "Forgot password?", new_password_path
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
def change
# Use Active Record's configured type for primary and foreign keys
primary_key_type, foreign_key_type = primary_and_foreign_key_types

create_table :active_storage_blobs, id: primary_key_type do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
t.text :metadata
t.string :service_name, null: false
t.bigint :byte_size, null: false
t.string :checksum

if connection.supports_datetime_with_precision?
t.datetime :created_at, precision: 6, null: false
else
t.datetime :created_at, null: false
end

t.index [ :key ], unique: true
end

create_table :active_storage_attachments, id: primary_key_type do |t|
t.string :name, null: false
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
t.references :blob, null: false, type: foreign_key_type

if connection.supports_datetime_with_precision?
t.datetime :created_at, precision: 6, null: false
else
t.datetime :created_at, null: false
end

t.index [ :record_type, :record_id, :name, :blob_id ], name: :index_active_storage_attachments_uniqueness, unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end

create_table :active_storage_variant_records, id: primary_key_type do |t|
t.belongs_to :blob, null: false, index: false, type: foreign_key_type
t.string :variation_digest, null: false

t.index [ :blob_id, :variation_digest ], name: :index_active_storage_variant_records_uniqueness, unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end

private
def primary_and_foreign_key_types
config = Rails.configuration.generators
setting = config.options[config.orm][:primary_key_type]
primary_key_type = setting || :primary_key
foreign_key_type = setting || :bigint
[ primary_key_type, foreign_key_type ]
end
end
Loading

0 comments on commit 1024851

Please sign in to comment.