commit c0b7bfe9cf6c4d4af5879c82bda32c7fb8875b34 Author: John Bintz Date: Fri Oct 12 17:34:10 2012 -0400 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d87d4be --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..957b394 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in activeadmin-dropdown_resources.gemspec +gemspec diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..87b491e --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012 John Bintz + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5349e01 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +Get a dropdown in Active Admin rather than a list of resource links at the top. + +In `app/assets/javascripts/admin_application.js`: + +``` javascript +//= require jquery +//= require active_admin/dropdown_resources +``` + +Easy! + diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..f57ae68 --- /dev/null +++ b/Rakefile @@ -0,0 +1,2 @@ +#!/usr/bin/env rake +require "bundler/gem_tasks" diff --git a/activeadmin-dropdown_resources.gemspec b/activeadmin-dropdown_resources.gemspec new file mode 100644 index 0000000..8aa0d0f --- /dev/null +++ b/activeadmin-dropdown_resources.gemspec @@ -0,0 +1,20 @@ +# -*- encoding: utf-8 -*- +require File.expand_path('../lib/activeadmin-dropdown_resources/version', __FILE__) + +Gem::Specification.new do |gem| + gem.authors = ["John Bintz"] + gem.email = ["john@coswellproductions.com"] + gem.description = %q{TODO: Write a gem description} + gem.summary = %q{TODO: Write a gem summary} + gem.homepage = "" + + gem.files = `git ls-files`.split($\) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.name = "activeadmin-dropdown_resources" + gem.require_paths = ["lib"] + gem.version = Activeadmin::DropdownResources::VERSION + + gem.add_dependency 'activeadmin' + gem.add_dependency 'coffee-script' +end diff --git a/lib/activeadmin-dropdown_resources.rb b/lib/activeadmin-dropdown_resources.rb new file mode 100644 index 0000000..a933890 --- /dev/null +++ b/lib/activeadmin-dropdown_resources.rb @@ -0,0 +1,8 @@ +require "activeadmin-dropdown_resources/version" + +if defined?(::Rails::Engine) + module ActiveAdmin + class DropdownResources < ::Rails::Engine + end + end +end diff --git a/lib/activeadmin-dropdown_resources/version.rb b/lib/activeadmin-dropdown_resources/version.rb new file mode 100644 index 0000000..8d5aca6 --- /dev/null +++ b/lib/activeadmin-dropdown_resources/version.rb @@ -0,0 +1,5 @@ +module Activeadmin + module DropdownResources + VERSION = "0.0.1" + end +end diff --git a/lib/assets/javascripts/active_admin/dropdown_resources.js.coffee b/lib/assets/javascripts/active_admin/dropdown_resources.js.coffee new file mode 100644 index 0000000..86e2080 --- /dev/null +++ b/lib/assets/javascripts/active_admin/dropdown_resources.js.coffee @@ -0,0 +1,28 @@ +$(-> + selector = $('