Skip to content

Instantly share code, notes, and snippets.

View anitagraham's full-sized avatar

Anita Graham anitagraham

  • Perth, Western Australia
View GitHub Profile
@anitagraham
anitagraham / Gemfile
Created April 27, 2021 02:42
Minimal config for setting up Refinerycms (April 2021)
# At least these refinery gems
gem 'refinerycms', git: 'https://github.com/refinery/refinerycms', branch: 'master'
gem 'refinerycms-authentication-devise', git: 'https://github.com/refinery/refinerycms-authentication-devise', ref: 'master'
gem 'refinerycms-wymeditor', git: 'https://github.com/parndt/refinerycms-wymeditor', branch: 'master'
@anitagraham
anitagraham / _form.html.haml
Created February 11, 2021 01:40
Spina Custom Part
-# app/views/spina/admin/parts/cards/_form.html.haml
.page-form-label= f.object.title
.page-form-control
# this line, as generated, produces "uninitialized constant Card"
.select-dropdown= f.select :card_id, Card.all.pluck(:title, :id)
# this line, with the model class in full gets "ActionView::Template::Error (undefined method `all' for Spina::Parts::Card:Class)"
.select-dropdown= f.select :card_id, Spina::Parts::Card.all.pluck(:title, :id)
@anitagraham
anitagraham / corrections.md
Last active October 22, 2019 08:44
TDD corrections
  • package.json doesn't have the watchAll switch appended to it, as the preceding paragraph claims.
  • Below the heading "Continue the Cycle" the code for validator.test.js has two problems.
    • There are stray }; on lines 4 and 10
    • The description for the second test 'should fail an object that meets a criteria' should be "should fail an object that doesn't meet a criteria". This description continues all the way to the end of the article.

What a great sentence the above would be if we removed all the quotes

It is at this point that I got irritated... but I continued to the end of the article and learned more about TDD.

Thanks and sorry for being a grump.

@anitagraham
anitagraham / Photo-components view.png
Last active January 28, 2018 20:11
rails has_many_through with checkboxes
Photo-components view.png
@anitagraham
anitagraham / Gemfile
Created April 6, 2016 14:35
Simple application with Refinery grafted on
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
group :development, :test do
gem 'sqlite3'
end
# Use SCSS for stylesheets
@anitagraham
anitagraham / icon.css
Created June 6, 2015 11:47
CSS applied to email icon
.email_icon::before {
color: #404650;
float: none;
font-size: 1.2em;
height: auto;
text-decoration: none;
width: auto;
}
.email_icon::before {
@anitagraham
anitagraham / upgrade.md
Last active October 20, 2015 07:29
Upgrading from Refinery 2.1 to Refinery 3.0

Upgrading a Refinery app to Refinery3, Rails 4.2#

Remove old config values

  1. DELETE config.whitelist_attributes
  2. DELETE config.mass_assignment_sanitizer
  3. DELETE config.active_record.auto_explain_threshold_in_seconds
  4. CHANGE config.serve_static_assets TO config.serve_static_files
  5. SET config.eager_load TO false (dev and test), true (production)
@anitagraham
anitagraham / _header.html.erb
Last active August 29, 2015 14:21
Zurb Foundation menu presenter for Refinery CMS.
#/app/views/refinery/shared/_header.html.erb
...
<section class="top-bar-section" id="menu">
<%= zurb_menu(refinery_menu_pages, list_tag_css: 'left').to_html %>
<ul class='right'>
<li> <a href="/contact">Contact Us</a></li>
</ul>
</section>
@anitagraham
anitagraham / Saving testimonial parameter
Last active August 29, 2015 14:19
Log file showing page.show_in_footer working/not working.
Started PATCH "/refinery/pages/about%2Fyou" for 127.0.0.1 at 2015-04-23 13:51:24 +0800
Processing by Refinery::Admin::PagesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"mAApJWM4ytov/8GzAPkEbRzgh/2ehr4wxP7Kws1kkFmWUdGKv38EgZ6/s3h1mYBWK4TMirmByXCCWkLX8SMyaQ==", "switch_locale"=>"en", "page"=>
{"title"=>"You", "parts_attributes"=>{"0"=>{"body"=>"<p>Here is some text about you</p>\r\n<p>\r\nYou you you!</p>", "position"=>"0", "id"=>"10"}, "1"=>{"body"=>"", "positio
n"=>"1", "id"=>"11"}}, "testimonials_show"=>"true", "testimonials_count"=>"2", "testimonials_select"=>"Recent", "draft"=>"0", "parent_id"=>"3", "view_template"=>"show", "men
u_title"=>"", "skip_to_first_child"=>"0", "link_url"=>"", "show_in_menu"=>"1", "show_in_footer"=>"1", "browser_title"=>"", "meta_description"=>""}, "continue_editing"=>"true
", "path"=>"about/you", "locale"=>:en}
Refinery::Page Load (0.6ms) SELECT `refinery_pages`.* FROM `refinery_pages` INNER JOIN `refinery_page_translations` ON `refinery_page_tr
@anitagraham
anitagraham / image_indexer.rb
Last active August 29, 2015 14:11
Shared contexts and Shared examples
#refinerycms/images/spec/support/shared examples/image_indexer.rb
shared_examples_for 'indexes images' do
let(:image_count) {[Refinery::Image.count, Refinery::Images.pages_per_admin_index].min}
before do
raise "please set let(:initial_path)" if initial_path.blank?
ensure_on(initial_path)
end