Skip to content

Instantly share code, notes, and snippets.

@justinfrench
justinfrench / SassMeister-input.sass
Created December 11, 2014 02:38
Generated by SassMeister.com.
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
.selector
@media screen and (min-width: 1024px)
&.-of-5
width: 20%
<% semantic_form_for @user do |form| %>
<%= form.inputs :title, :body, :section_id, :created_at %>
<%= form.buttons :commit %>
<% end %>
speechless:~/dev $ rails formtastic_test
create
create app/controllers
create app/helpers
... trimmed by JF
speechless:~/dev $ cd formtastic_test/
speechless:~/dev/formtastic_test $ ./script/plugin install git://github.com/justinfrench/formtastic.git
Initialized empty Git repository in .git/
warning: no common commits
remote: Counting objects: 26, done.
# 1. add this to formtastic_spec.rb inside the ":as => :select" describe block
it 'should have one option with a "selected" attribute' do
output_buffer.should have_tag('form li select option[@selected]', :count => 2) # the 2 is intentional
end
# 2. run the specs
expected
<form class="formtastic post" action="/posts" method="post" id="new_post"><li class="select optional" id="post_author_id_input"><label for="post_author_id">Author</label><select name="post[author_id]" id="post_author_id"><option value="37">Fred Smith</option>
# http://rpheath.com/posts/409-rails-time-date-formatting-with-lambda
Time::DATE_FORMATS.merge!(
:friendly => lambda { |time|
if time.year == Time.now.year
time.strftime "%b #{time.day.ordinalize}"
else
time.strftime "%b #{time.day.ordinalize}, %Y"
end
}
Parameters: {
"commit"=>"Create Post",
"post"=>{
"thing_attributes"=>{
"name"=>"sdfgsdf",
"about"=>"sdfg"
},
"body"=>"sdfgsdg",
"title"=>"sdfgsdg",
"published"=>"0"},
# renders a post[author_attributes][login]
form_for(@new_post) do |post|
post.fields_for(:author) do |author|
concat(author.text_field(:login))
end
end
# renders a post[author][login]
form_for(@new_post) do |post|
post.fields_for(@new_post.author) do |author|
Rails CMS alternatives
======================
Note: project activity was checked on 11/26/09.
Active projects:
---------------
adva-cms
repo: http://github.com/svenfuchs/adva_cms/
site: http://adva-cms.org/
Last update: 11/24/09
"You will receive a confimation email with in the business day.In case you haven't received Please call 13 6954 (13 myki) with your myki reference number ."
* spelling error "confimation"
* missing space "day.In"
* missing words and not need for capitalisation "haven't received Please call"
* missing the reference number "with your myki reference number ."
That was after filling in the feedback form 3 times and spending 30 mins on the phone with a nice person who couldn't actually help me.
foldingStartMarker = '(?x)
(<(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl|article|section|header|footer)\b.*?>
|<!--(?!.*-->)
|\{\s*($|\?>\s*$|//|/\*(.*\*/\s*$|(?!.*?\*/)))
|<%.*?do\s?(\|[a-z0-9_,\s]\|)?\s?-?%>
)';
foldingStopMarker = '(?x)
(</(?i:head|body|table|thead|tbody|tfoot|tr|div|select|fieldset|style|script|ul|ol|li|form|dl|article|section|header|footer)>
|^\s*-->
|(^|\s)\}