feat: migrate from Foundation to Fomantic-UI

Swap foundation-rails for fomantic-ui-sass across the gem's own
layout/menu/alerts partials and all 11 generic scaffold resources
(pages, news, faqs, quotes, images, directories, keywords, yml_files,
contact_forms, newsletter_subscriptions, users). Foundation grid/button
classes replaced with Fomantic ui.form/ui.button/ui.table conventions;
legacy Foundation mixins in the custom component sass (panel, button,
grid-row/grid-column) rewritten as plain CSS since they no longer exist
once foundation_and_overrides.scss is gone.

Also fixes a real bug found along the way: boolean_text used
`.present?` on values, but SimplyCouch stores booleans as the strings
"0"/"1" — and "0".present? is true in Ruby, so it always rendered
"Yes" regardless of actual value. Now uses ActiveModel::Type::Boolean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 23:36:35 -05:00
parent da5db36b4c
commit 4013070e4f
34 changed files with 187 additions and 1584 deletions
@@ -1,16 +1,17 @@
- if flash[:alert].present?
.row: .small-12.columns.alert-box.alert data-alert=true
.ui.negative.message
i.close.icon
= flash[:alert]
a.close href="" &#215;
- if flash[:notice].present?
.row: .small-12.columns.alert-box.info data-alert=true
.ui.positive.message
i.close.icon
= flash[:notice]
a.close href="" &#215;
- if warnings.any?
.row: .small-12.columns.alert-box.warning data-alert=true
ul
.ui.warning.message
i.close.icon
ul.list
- for warning in warnings
- if warning.is_a?(Hash)
li.warning= t("cmtool.warnings.#{warning.delete(:message)}", warning)
li= t("cmtool.warnings.#{warning.delete(:message)}", warning)
- else
li.warning= t("cmtool.warnings.#{warning}")
li= t("cmtool.warnings.#{warning}")
+24 -31
View File
@@ -1,32 +1,25 @@
- user = defined?(cmtool_user) ? cmtool_user : (defined?(current_user) ? current_user : nil)
.fixed
nav.top-bar data-topbar="" role="navigation"
ul.title-area
li.name
h1
a href=cmtool.root_path = application_title
li.toggle-topbar.menu-icon
a href="#"
span Menu
section.top-bar-section
- if user.present?
ul.right
li.has-dropdown
a href="#" = user.email
ul.dropdown
li.log-out= link_to t('helpers.links.logout'), main_app.root_path
ul.left
- Cmtool::Menu.items.each do |menu_item|
- if menu_item.group?
li.has-dropdown class=(menu_item.controller_names.include?(controller_name) ? 'active' : '')
a href="#" = menu_item.title
ul.dropdown
- menu_item.items.compact.each do |child_item|
- if child_item.divider?
li.divider
- else
li class=(controller_name == child_item.controller_name ? 'active' : '') = link_to child_item.title, child_item.path
- elsif menu_item.resource_link?
li class=(menu_item.controller_name == controller_name ? 'active' : '') = link_to menu_item.title, menu_item.path
- elsif menu_item.engine_link?
li= link_to menu_item.title, menu_item.path
.ui.inverted.menu
= link_to application_title, cmtool.root_path, class: 'header item'
- Cmtool::Menu.items.each do |menu_item|
- if menu_item.group?
.ui.dropdown.item class=(menu_item.controller_names.include?(controller_name) ? 'active' : nil)
= menu_item.title
i.dropdown.icon
.menu
- menu_item.items.compact.each do |child_item|
- if child_item.divider?
.divider
- else
= link_to child_item.title, child_item.path, class: ['item', (controller_name == child_item.controller_name ? 'active' : nil)]
- elsif menu_item.resource_link?
= link_to menu_item.title, menu_item.path, class: ['item', (menu_item.controller_name == controller_name ? 'active' : nil)]
- elsif menu_item.engine_link?
= link_to menu_item.title, menu_item.path, class: 'item'
.right.menu
- if user.present?
.ui.dropdown.item
span= user.email
i.dropdown.icon
.menu
= link_to t('helpers.links.logout'), main_app.root_path, class: 'item'
@@ -1,4 +1,4 @@
= form_for [cmtool, @contact_form] do |f|
= form_for [cmtool, @contact_form], html: {class: 'ui form'} do |f|
= render 'error_messages', :target => @contact_form
.field
@@ -17,4 +17,4 @@
= f.label :body
= f.text_area :body, class: :editor_full
.actions
= f.submit @submit || update_button_text(@contact_form)
= f.submit @submit || update_button_text(@contact_form), class: 'ui primary button'
@@ -1,6 +1,6 @@
- title :index, Cmtool::ContactForm
- if @contact_forms.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::ContactForm.human_attribute_name(:gender)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @directory], :html => {:multipart => true} do |f|
= form_for [cmtool, @directory], :html => {:multipart => true, :class => 'ui form'} do |f|
= render 'error_messages', :target => @directory
.field
= f.label :name
@@ -7,4 +7,4 @@
= f.label :parent_id, Cmtool::Directory.model_name.human
= f.select :parent_id, tree_options_for_select(Cmtool::Directory.full_tree, exclude: @directory.id, selected: @directory.parent_id), include_blank: ''
.actions
= f.submit @submit || update_button_text(@directory)
= f.submit @submit || update_button_text(@directory), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::Directory
- if @directories.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::Directory.human_attribute_name(:name)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @faq] do |f|
= form_for [cmtool, @faq], html: {class: 'ui form'} do |f|
= render 'error_messages', :target => @faq
.field
@@ -8,4 +8,4 @@
= f.label :answer
= f.text_area :answer, :rows => 6, :class => 'editor_basic'
.actions
= f.submit @submit || update_button_text(@faq)
= f.submit @submit || update_button_text(@faq), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::Faq
- if @faqs.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::Faq.human_attribute_name(:question)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @image], html: {multipart: true} do |f|
= form_for [cmtool, @image], html: {multipart: true, class: 'ui form'} do |f|
= render 'error_messages', target: @image
.field
@@ -9,4 +9,4 @@
= f.select :directory_id, Cmtool::Directory.all.map{|d| ["-"*d.tree_depth + ' ' + d.name.to_s, d.id]}
.actions
= f.submit @submit || update_button_text(@image)
= f.submit @submit || update_button_text(@image), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::Image
- if @images.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::Image.model_name.human
+2 -2
View File
@@ -1,7 +1,7 @@
= form_for [cmtool, @keyword] do |f|
= form_for [cmtool, @keyword], html: {class: 'ui form'} do |f|
= render 'error_messages', :target => @keyword
.form-row
.form-label= f.label :name
.form-field= f.text_field :name
.form-row: .form-actions
= f.submit @submit || update_button_text(@keyword), class: 'form-submit-button'
= f.submit @submit || update_button_text(@keyword), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::Keyword
- if @keywords.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::Keyword.human_attribute_name(:name)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @news], html: {multipart: true} do |f|
= form_for [cmtool, @news], html: {multipart: true, class: 'ui form'} do |f|
= render 'error_messages', target: @news
.field
= f.label :title
@@ -19,4 +19,4 @@
.field
= render "cmtool/keywords/habtm", subject: @news
.actions
= f.submit @submit || update_button_text(@news)
= f.submit @submit || update_button_text(@news), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::News
- if @news.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::News.human_attribute_name(:title)
@@ -1,4 +1,4 @@
= form_for [cmtool, @newsletter_subscription] do |f|
= form_for [cmtool, @newsletter_subscription], html: {class: 'ui form'} do |f|
= render 'error_messages', :target => @newsletter_subscription
.field
@@ -8,4 +8,4 @@
= f.label :active
= f.check_box :active
.actions
= f.submit @submit || update_button_text(@newsletter_subscription)
= f.submit @submit || update_button_text(@newsletter_subscription), class: 'ui primary button'
@@ -1,6 +1,6 @@
- title :index, Cmtool::NewsletterSubscription
- if @newsletter_subscriptions.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::NewsletterSubscription.human_attribute_name(:email)
+6 -5
View File
@@ -1,9 +1,10 @@
javascript:
page_vars = #{Cmtool::YmlFile.all_as_object.to_json.html_safe};
#preview-modal.reveal-modal.large data-reveal=""
iframe allowfullscreen="" frameborder="0" height="100%" src="about:blank" width="100%"
a.close-reveal-modal ×
= form_for [cmtool, @page] do |f|
#preview-modal.ui.large.modal
i.close.icon
.content
iframe allowfullscreen="" frameborder="0" height="100%" src="about:blank" width="100%"
= form_for [cmtool, @page], html: {class: 'ui form'} do |f|
= render 'error_messages', target: @page
.form-row
.form-label= f.label :name
@@ -58,5 +59,5 @@ javascript:
.field
= render "cmtool/keywords/habtm", subject: @page
.form-row: .form-actions
= f.submit @submit || update_button_text(f.object), class: 'button'
= f.submit @submit || update_button_text(f.object), class: 'ui primary button'
-#= button_tag 'Preview (unsupported)', onclick: %{$('form').attr('action', '/' + $('#page_name').val()).submit();}
+1 -1
View File
@@ -1,5 +1,5 @@
- title :index, Page
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Page.human_attribute_name(:name)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @quote], html: {multipart: true} do |f|
= form_for [cmtool, @quote], html: {multipart: true, class: 'ui form'} do |f|
= render 'error_messages', target: @quote
.field
= f.label :owner
@@ -19,4 +19,4 @@
= f.label :active
= f.check_box :active
.actions
= f.submit @submit || update_button_text(@quote)
= f.submit @submit || update_button_text(@quote), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::Quote
- if @quotes.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::Quote.human_attribute_name(:owner)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @user] do |f|
= form_for [cmtool, @user], html: {class: 'ui form'} do |f|
= render 'error_messages', :target => @user
.field
@@ -24,4 +24,4 @@
= f.label :admin
= f.check_box :admin
.actions
= f.submit @submit || update_button_text(@user)
= f.submit @submit || update_button_text(@user), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, User
- if @users.any?
table.index-table
table.ui.celled.table
thead
tr
th= User.human_attribute_name(:email)
+2 -2
View File
@@ -1,4 +1,4 @@
= form_for [cmtool, @yml_file] do |f|
= form_for [cmtool, @yml_file], html: {class: 'ui form'} do |f|
= render 'error_messages', :target => @yml_file
.form-row
.form-label= f.label :name
@@ -6,4 +6,4 @@
.form-row
= f.text_area :body, class: 'yml-content'
.form-row: .form-actions
= f.submit @submit || update_button_text(@yml_file), class: 'form-submit-button'
= f.submit @submit || update_button_text(@yml_file), class: 'ui primary button'
+1 -1
View File
@@ -1,6 +1,6 @@
- title :index, Cmtool::YmlFile
- if @yml_files.any?
table.index-table.table.table-striped.table-hover
table.ui.celled.table
thead
tr
th= Cmtool::YmlFile.human_attribute_name(:name)
+20 -19
View File
@@ -24,23 +24,24 @@ html lang="en"
body
= render 'cmtool/application/menu'
= render 'cmtool/application/alerts'
.row
.small-12.large-9.columns
h3= content_for?(:page_title) ? yield(:page_title) : application_title
= content_for?(:content) ? yield(:content) : yield
- if content_for?(:page_links)
#sub-navigation-container= yield(:page_links)
.show-for-large-up.large-3.columns
.panel
h4 Links
ul.side-nav
li= link_to "Home", cmtool.root_path
li= link_to 'Wiki', 'https://github.com/bterkuile/cmtool/wiki', target: :_blank
= yield :sidebar
footer
p
span &copy; Cmtool
span= Date.today.year
= yield :footer
.ui.container
= render 'cmtool/application/alerts'
.ui.grid
.twelve.wide.column
h3.ui.header= content_for?(:page_title) ? yield(:page_title) : application_title
= content_for?(:content) ? yield(:content) : yield
- if content_for?(:page_links)
#sub-navigation-container= yield(:page_links)
.four.wide.column
.ui.segment
h4.ui.header Links
.ui.link.list
a.item href=cmtool.root_path Home
a.item href="https://github.com/bterkuile/cmtool/wiki" target="_blank" Wiki
= yield :sidebar
footer.ui.footer
p
span &copy; Cmtool
span= Date.today.year
= yield :footer
#hidden-html.hide= yield :hidden_html