Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Colleen, Drew] Custom tags #71

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
141 changes: 73 additions & 68 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
tandem (0.2.3)
tandem (0.2.4)
cancan (= 1.6.7)
eco
paperclip
Expand All @@ -11,51 +11,51 @@ PATH
GEM
remote: http://rubygems.org/
specs:
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.8)
activesupport (= 3.2.8)
sprockets (~> 2.2.1)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
addressable (2.2.7)
archive-tar-minitar (0.5.2)
arel (3.0.2)
bcrypt-ruby (3.0.1)
builder (3.0.4)
cancan (1.6.7)
capybara (1.1.2)
capybara (2.0.3)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
capybara-webkit (0.10.1)
capybara (>= 1.0.0, < 1.2)
xpath (~> 1.0.0)
capybara-webkit (0.14.2)
capybara (~> 2.0, >= 2.0.2)
json
childprocess (0.3.1)
ffi (~> 1.0.6)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
cocaine (0.2.1)
coderay (1.0.5)
coffee-rails (3.2.2)
Expand All @@ -71,7 +71,7 @@ GEM
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
diff-lcs (1.1.3)
diff-lcs (1.2.1)
eco (1.0.0)
coffee-script
eco-source
Expand All @@ -89,7 +89,7 @@ GEM
factory_girl_rails (4.1.0)
factory_girl (~> 4.1.0)
railties (>= 3.0.0)
ffi (1.0.11)
ffi (1.6.0)
growl_notify (0.0.3)
rb-appscript
guard (1.4.0)
Expand All @@ -99,8 +99,9 @@ GEM
em-websocket (>= 0.2.0)
guard (>= 0.10.0)
multi_json (~> 1.0)
guard-rspec (1.2.1)
guard-rspec (2.5.1)
guard (>= 1.1)
rspec (~> 2.11)
guard-spork (0.3.2)
guard (>= 0.8.4)
spork (>= 0.8.4)
Expand All @@ -116,20 +117,20 @@ GEM
jquery-rails (1.0.18)
railties (~> 3.0)
thor (~> 0.14)
json (1.7.5)
json (1.7.7)
launchy (2.0.5)
addressable (~> 2.2.6)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
listen (0.5.3)
mail (2.4.4)
listen (0.7.3)
mail (2.5.3)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
method_source (0.7.0)
mime-types (1.19)
multi_json (1.3.6)
nokogiri (1.5.0)
mime-types (1.21)
multi_json (1.7.2)
nokogiri (1.5.9)
orm_adapter (0.0.5)
paperclip (2.6.0)
activerecord (>= 2.3.0)
Expand All @@ -142,50 +143,52 @@ GEM
coderay (~> 1.0.5)
method_source (~> 0.7)
slop (>= 2.4.3, < 3)
rack (1.4.1)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.8)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
railties (= 3.2.13)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rake (10.0.4)
rb-appscript (0.6.1)
rb-fchange (0.0.5)
ffi
rb-fsevent (0.9.0)
rb-inotify (0.8.8)
ffi (>= 0.5.0)
rdoc (3.12)
rdoc (3.12.2)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.3)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.3)
rspec-rails (2.11.4)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.0)
rspec-rails (2.13.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec (~> 2.11.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
Expand All @@ -196,17 +199,17 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
rubyzip (0.9.6.1)
sass (3.1.15)
sass-rails (3.2.5)
rubyzip (0.9.9)
sass (3.2.7)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.20.0)
selenium-webdriver (2.31.0)
childprocess (>= 0.2.5)
ffi (~> 1.0)
multi_json (~> 1.0)
rubyzip
websocket (~> 1.0.4)
slim (1.0.4)
temple (~> 0.3.4)
tilt (~> 1.3.2)
Expand All @@ -217,23 +220,25 @@ GEM
slim (~> 1.0)
slop (2.4.3)
spork (0.9.0)
sprockets (2.1.3)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
temple (0.3.4)
thor (0.16.0)
tilt (1.3.3)
thor (0.18.0)
tilt (1.3.6)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.34)
tzinfo (0.3.37)
uglifier (1.2.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.0)
rack (>= 1.0)
xpath (0.1.4)
websocket (1.0.7)
xpath (1.0.0)
nokogiri (~> 1.3)

PLATFORMS
Expand Down
6 changes: 6 additions & 0 deletions History.rdoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.2.5
* Feature - As a developer, I should be able to specify the html tag I want my tandem tag wrapped in, so I have more control over the generated markup.

0.2.4 - January 3rd, 2013
* Feature - A user should be able to embed Youtube videos to a page

0.2.3 - August 9th, 2012
* Bug - Options passed to a main_app url_helper from within tandem get passed as an array
* Feature - CSS specification overhaul to have tandem styles override any exisiting website styles when Tandem UI is being used
Expand Down
5 changes: 5 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ you can set the <tt>editor</tt> option to <tt>:wysiwyg</tt>:

<%= tandem_text_tag(:sidebar_text, editor: :wysiwyg) %>

By default, tandem wraps content in a div tag. If you'd prefer a different tag, simply
specify it with the tag option.

<%= tandem_text_tag(:sidebar_text, tag: :h1) %>

=== Navigation

Tandem comes with a helper method to add a navigation menu. It's not included in the default
Expand Down
3 changes: 2 additions & 1 deletion app/helpers/tandem/pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ def self.included(base)
# <%= tandem_content_tag(:main_body, :text, editor: :wysiwyg) %>
def tandem_content_tag(identifier, type, options = {}, html_options = {})
options[:editor] ||= :plain
options[:tag] ||= :div

using_tandem_abilities do
tandem_content = Content.scoped_type(type).constantize.find_or_create_by_request_key_and_tag(request_key, identifier)

content = case tandem_content
when Content::Text
content_tag(:div, tandem_content, options.merge(
content_tag(options[:tag], tandem_content, options.merge(
id: "#{dom_class(tandem_content)}_#{identifier}",
class: "#{dom_class(tandem_content)} #{options[:class]}".strip
)) {
Expand Down
1 change: 0 additions & 1 deletion spec/dummy/app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<body>

<%= tandem_navigation_tag(@page) %>
<%= tandem_page_links %>

<%= yield %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
describe "Tandem Content on non-tandem pages" do
describe "get /widgets" do
it "renders the widgets index and creates a tandem content items" do
get '/widgets'
visit '/widgets'
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

describe "get /tandem" do
it "renders the home page" do
get '/tandem'
visit '/tandem'
end
end

Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions spec/helpers/tandem/pages_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ module Tandem

it { should =~ /id="tandem_content_link_#{content.tag}"/ }
end

describe 'the content tag' do
it 'should default to using a div' do
subject.should have_selector('div')
end

context 'when specifying a tag' do
subject { helper.tandem_content_tag(content.tag, :text, tag: :h1) }

it 'should use the tag specified in the options hash' do
subject.should have_selector("h1#content_text_#{content.tag}")
end
end
end
end

context "for a user who can edit content" do
Expand Down
2 changes: 1 addition & 1 deletion spec/routing/tandem/contents_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Tandem
require "spec_helper"

describe ContentsController do
before(:each) { @routes = Engine.routes }
before(:each) { assertion_instance.instance_variable_set(:@routes, Engine.routes) }

describe "routing" do

Expand Down
4 changes: 2 additions & 2 deletions spec/routing/tandem/images_routing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Tandem
require "spec_helper"

describe ImagesController do
before(:each) { @routes = Engine.routes }
before(:each) { assertion_instance.instance_variable_set(:@routes, Engine.routes) }

describe "routing" do

Expand Down Expand Up @@ -40,4 +40,4 @@ module Tandem

end
end
end
end
Loading