Allow cmtool helpers to be used in other namespaces

This commit is contained in:
2015-10-05 10:36:52 +02:00
parent 6b6a7405ba
commit 7dc12ca3e8
4 changed files with 77 additions and 65 deletions
+1
View File
@@ -10,3 +10,4 @@ spec/dummy/.sass-cache
spec/dummy/public spec/dummy/public
*.gem *.gem
routes.txt routes.txt
/.project
+2 -1
View File
@@ -27,7 +27,6 @@ gem 'devise_simply_stored', github: 'bterkuile/devise_simply_stored'
gem 'slim-rails' gem 'slim-rails'
gem 'paperclip', ['>= 3.4', '!= 4.3.0'] gem 'paperclip', ['>= 3.4', '!= 4.3.0']
gem 'email_validator' gem 'email_validator'
gem 'actionpack-page_caching'
# Declare any dependencies that are still in development here instead of in # Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or # your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing # Git. Remember to move these dependencies to your gemspec before releasing
@@ -38,6 +37,7 @@ group :development, :test do
gem 'rspec-rails' gem 'rspec-rails'
gem 'pry-rails' gem 'pry-rails'
end end
group :test do group :test do
gem 'factory_girl_rails' gem 'factory_girl_rails'
gem 'capybara' gem 'capybara'
@@ -45,6 +45,7 @@ group :test do
gem 'rspec-its' gem 'rspec-its'
gem 'launchy' gem 'launchy'
end end
group :development do group :development do
gem 'thin' gem 'thin'
#gem 'ruby-debug19', :require => 'ruby-debug' #gem 'ruby-debug19', :require => 'ruby-debug'
+61 -62
View File
@@ -13,11 +13,11 @@ GIT
GIT GIT
remote: git://github.com/bterkuile/simply_stored.git remote: git://github.com/bterkuile/simply_stored.git
revision: 05cb3a06a9d4a3588efd4491db42fac84276befb revision: 0941952120c7fbb3c7a38486cd26d9380fb657aa
specs: specs:
simply_stored (1.0.0) simply_stored (1.0.0)
activesupport activesupport
couch_potato (>= 0.2.15) couch_potato (>= 1.4.0)
rest-client (>= 1.4.2) rest-client (>= 1.4.2)
PATH PATH
@@ -38,52 +38,50 @@ PATH
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
ace-rails-ap (3.0.3) ace-rails-ap (4.0.0)
actionmailer (4.2.3) actionmailer (4.2.4)
actionpack (= 4.2.3) actionpack (= 4.2.4)
actionview (= 4.2.3) actionview (= 4.2.4)
activejob (= 4.2.3) activejob (= 4.2.4)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.3) actionpack (4.2.4)
actionview (= 4.2.3) actionview (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
rack (~> 1.6) rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionpack-page_caching (1.0.2) actionview (4.2.4)
actionpack (>= 4.0.0, < 5) activesupport (= 4.2.4)
actionview (4.2.3)
activesupport (= 4.2.3)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.3) activejob (4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
globalid (>= 0.3.0) globalid (>= 0.3.0)
activemodel (4.2.3) activemodel (4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.3) activerecord (4.2.4)
activemodel (= 4.2.3) activemodel (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
arel (~> 6.0) arel (~> 6.0)
activesupport (4.2.3) activesupport (4.2.4)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.3.8) addressable (2.3.8)
arel (6.0.2) arel (6.0.3)
bcrypt (3.1.10) bcrypt (3.1.10)
bourbon (4.2.3) bourbon (4.2.5)
sass (~> 3.4) sass (~> 3.4)
thor thor (~> 0.19)
builder (3.2.2) builder (3.2.2)
capybara (2.4.4) capybara (2.5.0)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
rack (>= 1.0.0) rack (>= 1.0.0)
@@ -108,7 +106,7 @@ GEM
multi_json (~> 1.7, ~> 1.0) multi_json (~> 1.7, ~> 1.0)
rest-client (~> 1.8.0) rest-client (~> 1.8.0)
daemons (1.2.3) daemons (1.2.3)
devise (3.5.1) devise (3.5.2)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 3.2.6, < 5)
@@ -121,55 +119,57 @@ GEM
email_validator (1.6.0) email_validator (1.6.0)
activemodel activemodel
erubis (2.7.0) erubis (2.7.0)
eventmachine (1.0.7) eventmachine (1.0.8)
execjs (2.5.2) execjs (2.6.0)
factory_girl (4.5.0) factory_girl (4.5.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
factory_girl_rails (4.5.0) factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0) factory_girl (~> 4.5.0)
railties (>= 3.0.0) railties (>= 3.0.0)
font-awesome-rails (4.3.0.0) font-awesome-rails (4.4.0.0)
railties (>= 3.2, < 5.0) railties (>= 3.2, < 5.0)
foundation-rails (5.5.2.1) foundation-rails (5.5.2.1)
railties (>= 3.1.0) railties (>= 3.1.0)
sass (>= 3.3.0, < 3.5) sass (>= 3.3.0, < 3.5)
globalid (0.3.5) globalid (0.3.6)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
http-cookie (1.0.2) http-cookie (1.0.2)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (0.7.0) i18n (0.7.0)
jquery-rails (4.0.4) jquery-rails (4.0.5)
rails-dom-testing (~> 1.0) rails-dom-testing (~> 1.0)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
json (1.8.3) json (1.8.3)
launchy (2.4.3) launchy (2.4.3)
addressable (~> 2.3) addressable (~> 2.3)
loofah (2.0.2) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.3) mail (2.6.3)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
method_source (0.8.2) method_source (0.8.2)
mime-types (2.6.1) mime-types (2.6.2)
mimemagic (0.3.0)
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.7.0) minitest (5.8.1)
multi_json (1.11.2) multi_json (1.11.2)
netrc (0.10.3) netrc (0.10.3)
nokogiri (1.6.6.2) nokogiri (1.6.6.2)
mini_portile (~> 0.6.0) mini_portile (~> 0.6.0)
paperclip (4.2.4) paperclip (4.3.1)
activemodel (>= 3.2.0) activemodel (>= 3.2.0)
activesupport (>= 3.2.0) activesupport (>= 3.2.0)
cocaine (~> 0.5.5) cocaine (~> 0.5.5)
mime-types mime-types
mimemagic (= 0.3.0)
pickadate-rails (3.5.6.0) pickadate-rails (3.5.6.0)
railties (>= 3.1.0) railties (>= 3.1.0)
poltergeist (1.6.0) poltergeist (1.7.0)
capybara (~> 2.1) capybara (~> 2.1)
cliver (~> 0.3.1) cliver (~> 0.3.1)
multi_json (~> 1.0) multi_json (~> 1.0)
websocket-driver (>= 0.2.0) websocket-driver (>= 0.2.0)
pry (0.10.1) pry (0.10.2)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
slop (~> 3.4) slop (~> 3.4)
@@ -178,28 +178,28 @@ GEM
rack (1.6.4) rack (1.6.4)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.3) rails (4.2.4)
actionmailer (= 4.2.3) actionmailer (= 4.2.4)
actionpack (= 4.2.3) actionpack (= 4.2.4)
actionview (= 4.2.3) actionview (= 4.2.4)
activejob (= 4.2.3) activejob (= 4.2.4)
activemodel (= 4.2.3) activemodel (= 4.2.4)
activerecord (= 4.2.3) activerecord (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.3) railties (= 4.2.4)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.6) rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0) activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.2) rails-html-sanitizer (1.0.2)
loofah (~> 2.0) loofah (~> 2.0)
railties (4.2.3) railties (4.2.4)
actionpack (= 4.2.3) actionpack (= 4.2.4)
activesupport (= 4.2.3) activesupport (= 4.2.4)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (10.4.2) rake (10.4.2)
@@ -229,13 +229,13 @@ GEM
rspec-mocks (~> 3.3.0) rspec-mocks (~> 3.3.0)
rspec-support (~> 3.3.0) rspec-support (~> 3.3.0)
rspec-support (3.3.0) rspec-support (3.3.0)
sass (3.4.16) sass (3.4.18)
sass-rails (5.0.3) sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 5.0)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (~> 1.1) tilt (>= 1.1, < 3)
slim (3.0.6) slim (3.0.6)
temple (~> 0.7.3) temple (~> 0.7.3)
tilt (>= 1.3.3, < 2.1) tilt (>= 1.3.3, < 2.1)
@@ -246,21 +246,21 @@ GEM
railties (>= 3.1, < 5.0) railties (>= 3.1, < 5.0)
slim (~> 3.0) slim (~> 3.0)
slop (3.6.0) slop (3.6.0)
sprockets (3.2.0) sprockets (3.3.5)
rack (~> 1.0) rack (> 1, < 3)
sprockets-rails (2.3.2) sprockets-rails (2.3.3)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
temple (0.7.6) temple (0.7.6)
thin (1.6.3) thin (1.6.4)
daemons (~> 1.0, >= 1.0.9) daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0) eventmachine (~> 1.0, >= 1.0.4)
rack (~> 1.0) rack (~> 1.0)
thor (0.19.1) thor (0.19.1)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (1.4.1) tilt (2.0.1)
tinymce-rails (4.2.1) tinymce-rails (4.2.5)
railties (>= 3.1.1) railties (>= 3.1.1)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
@@ -280,7 +280,6 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
ace-rails-ap ace-rails-ap
actionpack-page_caching
bourbon bourbon
capybara capybara
cmtool! cmtool!
+13 -2
View File
@@ -131,16 +131,27 @@ module Cmtool
end end
def edit_td(obj) def edit_td(obj)
path = case obj
when Array then edit_polymorphic_path(obj)
when SimplyStored::Couch then edit_polymorphic_path([cmtool, obj])
else obj
end
content_tag( content_tag(
:td, :td,
link_to((content_tag(:span, '', class: [:edit, 'fa fa-lg fa-pencil'])), cmtool.url_for([:edit, obj]), class: 'tiny warning button'), link_to((content_tag(:span, '', class: [:edit, 'fa fa-lg fa-pencil'])), path, class: 'tiny warning button'),
class: [:action, :edit] class: [:action, :edit]
) )
end end
def destroy_td(obj) def destroy_td(obj)
path = case obj
when Array then polymorphic_path(obj)
when SimplyStored::Couch then polymorphic_path([cmtool, obj])
else obj
end
content_tag( content_tag(
:td, :td,
link_to(content_tag(:span, '', class: [:destroy, 'fa fa-lg fa-trash']), cmtool.url_for(obj), method: :delete, class: 'tiny alert button', data: {confirm: are_you_sure(obj) }), link_to(content_tag(:span, '', class: [:destroy, 'fa fa-lg fa-trash']), path, method: :delete, class: 'tiny alert button', data: {confirm: are_you_sure(obj) }),
class: [:action, :destroy] class: [:action, :destroy]
) )
end end