actionview-helpers-auto_tag_helper 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +10 -0
 - data/.rspec +2 -0
 - data/.travis.yml +4 -0
 - data/CODE_OF_CONDUCT.md +13 -0
 - data/Gemfile +8 -0
 - data/LICENSE +22 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +41 -0
 - data/Rakefile +6 -0
 - data/actionview-helpers-auto_tag_helper.gemspec +37 -0
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/lib/action_view/helpers/auto_tag_helper.rb +152 -0
 - data/lib/action_view/helpers/auto_tag_helper/display_types.rb +51 -0
 - data/lib/action_view/helpers/auto_tag_helper/display_types/google_map.rb +17 -0
 - data/lib/action_view/helpers/auto_tag_helper/form_info.rb +129 -0
 - data/lib/action_view/helpers/auto_tag_helper/version.rb +7 -0
 - data/lib/actionview/helpers/auto_tag_helper.rb +1 -0
 - metadata +160 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1ea5ed3f6bda855fc5c91368fb0cb0eeb1c2f67b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 401f7b396a52a341582dd9f1d0da0127acf463cb
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 051d6ec33894d2b7cb4485a89a05d524b26fc8bf01e5cb6a012ada7b3e6d3f3f055356cfb53c99d7737a529b01c187ebd1bd0e15f3c6c25860fe0e4c43de6a2f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4c8df17ed2df77eeaad904aa3ce19cd359ab272cd7894c1bcbab59365f458cf6c49d7c9cad2e06b99c3894bea3e9ea9d60d7ae184470b79ac483b4a7bcb6e212
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.rspec
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/CODE_OF_CONDUCT.md
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Contributor Code of Conduct
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 baseball-bridge
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
      
 21 
     | 
    
         
            +
            SOFTWARE.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2015 Shinjiro Itagaki
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # ActionView::Helpers::AutoTagHelper
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/actionview/helpers/auto_tag_helper`. To experiment with that code, run `bin/console` for an interactive prompt.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            TODO: Delete this and the text above, and describe your gem
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 12 
     | 
    
         
            +
            gem 'actionview-helpers-auto_tag_helper'
         
     | 
| 
      
 13 
     | 
    
         
            +
            ```
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                $ gem install actionview-helpers-auto_tag_helper
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/actionview-helpers-auto_tag_helper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,37 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'action_view/helpers/auto_tag_helper/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "actionview-helpers-auto_tag_helper"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = ActionView::Helpers::AutoTagHelper::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Shinjiro Itagaki"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["ishinjiroster@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = "Helper for generate input tags automatically"
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.description   = "Helper for generate input tags automatically by detect column info"
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.homepage      = "https://github.com/baseball-bridge/actionview-helpers-auto_tag_helper"
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
         
     | 
| 
      
 18 
     | 
    
         
            +
              # delete this section to allow pushing this gem to any host.
         
     | 
| 
      
 19 
     | 
    
         
            +
              if spec.respond_to?(:metadata)
         
     | 
| 
      
 20 
     | 
    
         
            +
            #    spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
         
     | 
| 
      
 21 
     | 
    
         
            +
              else
         
     | 
| 
      
 22 
     | 
    
         
            +
                raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.bindir        = "exe"
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.10"
         
     | 
| 
      
 31 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 32 
     | 
    
         
            +
              spec.add_development_dependency "rspec"
         
     | 
| 
      
 33 
     | 
    
         
            +
              spec.add_development_dependency "activerecord"
         
     | 
| 
      
 34 
     | 
    
         
            +
              spec.add_development_dependency 'sqlite3'
         
     | 
| 
      
 35 
     | 
    
         
            +
              spec.add_dependency "actionview"
         
     | 
| 
      
 36 
     | 
    
         
            +
              spec.add_dependency 'activesupport', '>= 4.2.3'
         
     | 
| 
      
 37 
     | 
    
         
            +
            end
         
     | 
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "actionview/helpers/auto_tag_helper"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
| 
         @@ -0,0 +1,152 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "action_view"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "action_view/helpers"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "action_view/helpers/auto_tag_helper/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "action_view/helpers/auto_tag_helper/form_info"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "action_view/helpers/auto_tag_helper/display_types"
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module ActionView
         
     | 
| 
      
 8 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 9 
     | 
    
         
            +
                module AutoTagHelper
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  # == Parameters:
         
     | 
| 
      
 12 
     | 
    
         
            +
                  # method_name::
         
     | 
| 
      
 13 
     | 
    
         
            +
                  #   called method name
         
     | 
| 
      
 14 
     | 
    
         
            +
                  # rec::
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #   object which is called method
         
     | 
| 
      
 16 
     | 
    
         
            +
                  # html_options::
         
     | 
| 
      
 17 
     | 
    
         
            +
                  #   html options , ex: {style: "width: 100px; height: 100px; color: #ff0000;" placeholder: 'your name'}
         
     | 
| 
      
 18 
     | 
    
         
            +
                  #
         
     | 
| 
      
 19 
     | 
    
         
            +
                  def display_tag(method_name,rec,html_options={})
         
     | 
| 
      
 20 
     | 
    
         
            +
                    rec.class.try(:reflections).try(:each) do |reflname,refl|
         
     | 
| 
      
 21 
     | 
    
         
            +
                      if refl.foreign_key.to_sym == method_name.to_sym && refl.macro == :belongs_to
         
     | 
| 
      
 22 
     | 
    
         
            +
                        method_name = reflname
         
     | 
| 
      
 23 
     | 
    
         
            +
                        break
         
     | 
| 
      
 24 
     | 
    
         
            +
                      end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
                    v = rec.__send__(method_name)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    display_tag_with_display_options(v,rec,method_name,html_options) || v.try(:__display__) || v.to_s
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def display_tag_with_display_options(v,rec,method_name,html_options={})
         
     | 
| 
      
 31 
     | 
    
         
            +
                    if !rec.class.respond_to? :display_options
         
     | 
| 
      
 32 
     | 
    
         
            +
                      return nil
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                    opts = (rec.class.display_options(method_name) || {}).symbolize_keys
         
     | 
| 
      
 36 
     | 
    
         
            +
                    opt_type = opts[:type]
         
     | 
| 
      
 37 
     | 
    
         
            +
                    opt_method = opts[:method]
         
     | 
| 
      
 38 
     | 
    
         
            +
                    display_type = ActionView::Helpers::AutoTagHelper::DisplayTypes[opt_type]
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    if !(opt_method || display_type)
         
     | 
| 
      
 41 
     | 
    
         
            +
                      return nil
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                    args = (opts[:args] || [v])
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                    if args.kind_of? Proc
         
     | 
| 
      
 47 
     | 
    
         
            +
                      args = args.call(v,rec)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                    if !args.kind_of? Array
         
     | 
| 
      
 51 
     | 
    
         
            +
                      args = [args]
         
     | 
| 
      
 52 
     | 
    
         
            +
                    end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
                    if opt_method
         
     | 
| 
      
 55 
     | 
    
         
            +
                      @tag_options = html_options
         
     | 
| 
      
 56 
     | 
    
         
            +
                      r = self.__send__(opt_method,*args)
         
     | 
| 
      
 57 
     | 
    
         
            +
                      @tag_options = nil
         
     | 
| 
      
 58 
     | 
    
         
            +
                      r
         
     | 
| 
      
 59 
     | 
    
         
            +
                    else
         
     | 
| 
      
 60 
     | 
    
         
            +
                      display_type.display_tag(v,html_options)
         
     | 
| 
      
 61 
     | 
    
         
            +
                    end
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                  def auto_input_tag(sym,model,name,value)
         
     | 
| 
      
 65 
     | 
    
         
            +
                    column = model.columns_hash[sym.to_s]
         
     | 
| 
      
 66 
     | 
    
         
            +
                    type = column.type
         
     | 
| 
      
 67 
     | 
    
         
            +
                    opts = model.try(:input_options,sym) || {}
         
     | 
| 
      
 68 
     | 
    
         
            +
                    reference_tag(sym,model,name,value) || boolean_tag(type,name,value) || datetime_tag(type,name,value,opts) || number_tag(type,name,value,opts) || text_tag(type,name,value,opts)
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  def reference_tag(sym,model,name,value)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    if !model.respond_to? :select_list
         
     | 
| 
      
 73 
     | 
    
         
            +
                      return nil
         
     | 
| 
      
 74 
     | 
    
         
            +
                    end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                    rtn = nil
         
     | 
| 
      
 77 
     | 
    
         
            +
                    column = model.columns_hash[sym.to_s]
         
     | 
| 
      
 78 
     | 
    
         
            +
                    if list = model.select_list(sym)
         
     | 
| 
      
 79 
     | 
    
         
            +
                      rtn = select_tag(name,options_from_collection_for_select(list, :id, :__display__, value.to_s),include_blank: column.null)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
      
 81 
     | 
    
         
            +
                    rtn
         
     | 
| 
      
 82 
     | 
    
         
            +
                  end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                  def boolean_tag(type,name,value)
         
     | 
| 
      
 85 
     | 
    
         
            +
                    if type.to_sym == :boolean
         
     | 
| 
      
 86 
     | 
    
         
            +
                      check_box_tag(name,value="1",value)
         
     | 
| 
      
 87 
     | 
    
         
            +
                    else
         
     | 
| 
      
 88 
     | 
    
         
            +
                      nil
         
     | 
| 
      
 89 
     | 
    
         
            +
                    end
         
     | 
| 
      
 90 
     | 
    
         
            +
                  end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
                  # type == :integer
         
     | 
| 
      
 93 
     | 
    
         
            +
                  #   [:range  :week , :month]
         
     | 
| 
      
 94 
     | 
    
         
            +
                  def number_tag(type,name,value,opts={})
         
     | 
| 
      
 95 
     | 
    
         
            +
                    case type.to_sym
         
     | 
| 
      
 96 
     | 
    
         
            +
                    when :integer
         
     | 
| 
      
 97 
     | 
    
         
            +
                      opts = opts.stringify_keys
         
     | 
| 
      
 98 
     | 
    
         
            +
                      case (opts["type"] || type).to_sym
         
     | 
| 
      
 99 
     | 
    
         
            +
                      when :range
         
     | 
| 
      
 100 
     | 
    
         
            +
                        range_field_tag(name, value, opts)
         
     | 
| 
      
 101 
     | 
    
         
            +
                      when :week,:month
         
     | 
| 
      
 102 
     | 
    
         
            +
                        text_field_tag(name, value, opts)
         
     | 
| 
      
 103 
     | 
    
         
            +
                      else
         
     | 
| 
      
 104 
     | 
    
         
            +
                        number_field_tag(name, value, opts)
         
     | 
| 
      
 105 
     | 
    
         
            +
                      end
         
     | 
| 
      
 106 
     | 
    
         
            +
                    when :float,:decimal
         
     | 
| 
      
 107 
     | 
    
         
            +
                      number_field_tag(name, value, opts)
         
     | 
| 
      
 108 
     | 
    
         
            +
                    else
         
     | 
| 
      
 109 
     | 
    
         
            +
                      nil
         
     | 
| 
      
 110 
     | 
    
         
            +
                    end
         
     | 
| 
      
 111 
     | 
    
         
            +
                  end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                  # type == :datetime
         
     | 
| 
      
 114 
     | 
    
         
            +
                  #   datetime-local
         
     | 
| 
      
 115 
     | 
    
         
            +
                  def datetime_tag(type,name,value,opts={})
         
     | 
| 
      
 116 
     | 
    
         
            +
                    type = type.to_sym
         
     | 
| 
      
 117 
     | 
    
         
            +
                    case type
         
     | 
| 
      
 118 
     | 
    
         
            +
                    when :datetime
         
     | 
| 
      
 119 
     | 
    
         
            +
                      opts = opts.stringify_keys
         
     | 
| 
      
 120 
     | 
    
         
            +
                      opts["type"] ||= type.to_s
         
     | 
| 
      
 121 
     | 
    
         
            +
                      text_field_tag(name,value,opts)
         
     | 
| 
      
 122 
     | 
    
         
            +
                    when :time,:date
         
     | 
| 
      
 123 
     | 
    
         
            +
                      text_field_tag(name,value,opts.merge(type: type))
         
     | 
| 
      
 124 
     | 
    
         
            +
                    else
         
     | 
| 
      
 125 
     | 
    
         
            +
                      nil
         
     | 
| 
      
 126 
     | 
    
         
            +
                    end
         
     | 
| 
      
 127 
     | 
    
         
            +
                  end
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                  # type == :string
         
     | 
| 
      
 130 
     | 
    
         
            +
                  #   input_type: [:color, :email, :number, :password, :tel, :url]
         
     | 
| 
      
 131 
     | 
    
         
            +
                  def text_tag(type,name,value,opts={})
         
     | 
| 
      
 132 
     | 
    
         
            +
                    case type.to_sym
         
     | 
| 
      
 133 
     | 
    
         
            +
                    when :text
         
     | 
| 
      
 134 
     | 
    
         
            +
                      text_area_tag(name,value)
         
     | 
| 
      
 135 
     | 
    
         
            +
                    when :string
         
     | 
| 
      
 136 
     | 
    
         
            +
                      text_field_tag(name,value,opts)
         
     | 
| 
      
 137 
     | 
    
         
            +
                    else
         
     | 
| 
      
 138 
     | 
    
         
            +
                      nil
         
     | 
| 
      
 139 
     | 
    
         
            +
                    end
         
     | 
| 
      
 140 
     | 
    
         
            +
                  end
         
     | 
| 
      
 141 
     | 
    
         
            +
                end
         
     | 
| 
      
 142 
     | 
    
         
            +
                include AutoTagHelper
         
     | 
| 
      
 143 
     | 
    
         
            +
                include FormTagHelper
         
     | 
| 
      
 144 
     | 
    
         
            +
                def tag_options(options, escape = true)
         
     | 
| 
      
 145 
     | 
    
         
            +
                  if @tag_options.is_a?(Hash)
         
     | 
| 
      
 146 
     | 
    
         
            +
                    options = options.merge(@tag_options)
         
     | 
| 
      
 147 
     | 
    
         
            +
                    @tag_options = nil
         
     | 
| 
      
 148 
     | 
    
         
            +
                  end
         
     | 
| 
      
 149 
     | 
    
         
            +
                  super(options, escape)
         
     | 
| 
      
 150 
     | 
    
         
            +
                end
         
     | 
| 
      
 151 
     | 
    
         
            +
              end
         
     | 
| 
      
 152 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'active_support'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.expand_path('display_types/google_map',File.dirname(__FILE__))
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module ActionView
         
     | 
| 
      
 5 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 6 
     | 
    
         
            +
                module AutoTagHelper
         
     | 
| 
      
 7 
     | 
    
         
            +
                  module DisplayTypes
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                    @@display_types = {}
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    # ==== For examples
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #   module MyGoogleMapByLatLon
         
     | 
| 
      
 13 
     | 
    
         
            +
                    #     def self.display_tag latlon
         
     | 
| 
      
 14 
     | 
    
         
            +
                    #       lat = latlon[:lat]
         
     | 
| 
      
 15 
     | 
    
         
            +
                    #       lon = latlon[:lon]
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #       ...
         
     | 
| 
      
 17 
     | 
    
         
            +
                    #     end
         
     | 
| 
      
 18 
     | 
    
         
            +
                    #   end
         
     | 
| 
      
 19 
     | 
    
         
            +
                    #
         
     | 
| 
      
 20 
     | 
    
         
            +
                    #   ActionView::Helpers::AutoTagHelper::DisplayTypes.register(:google_map_latlon, MyGoogleMapByLatLon)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    #
         
     | 
| 
      
 22 
     | 
    
         
            +
                    #   class User < ActiveRecord::Base
         
     | 
| 
      
 23 
     | 
    
         
            +
                    #     set_display_type(:myhome_coodinates, :google_map_latlon)
         
     | 
| 
      
 24 
     | 
    
         
            +
                    #     def myhome_coodinates
         
     | 
| 
      
 25 
     | 
    
         
            +
                    #       {lat: self.lat, lon: self.lon}
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #     end
         
     | 
| 
      
 27 
     | 
    
         
            +
                    #   end
         
     | 
| 
      
 28 
     | 
    
         
            +
                    #
         
     | 
| 
      
 29 
     | 
    
         
            +
                    #   user = User.find(1)
         
     | 
| 
      
 30 
     | 
    
         
            +
                    #   display_tag(:myhome_coodinates, user, width: 600, height: 350)
         
     | 
| 
      
 31 
     | 
    
         
            +
                    #   # => MyGoogleMapByLatLon.display_tag(user.myhome_coodinates,width: 600, height: 350)
         
     | 
| 
      
 32 
     | 
    
         
            +
                    def self.register(type_name, obj)
         
     | 
| 
      
 33 
     | 
    
         
            +
                      @@display_types[type_name.to_sym]=obj
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    # register(:google_map_latlon, GoogleMapByLatLon)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    # get(:google_map_latlon)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    #   # => GoogleMapByLatLon
         
     | 
| 
      
 39 
     | 
    
         
            +
                    def self.get(type_name)
         
     | 
| 
      
 40 
     | 
    
         
            +
                      type_name.present? ? @@display_types[type_name.to_sym] : nil
         
     | 
| 
      
 41 
     | 
    
         
            +
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                    def self.[](type_name)
         
     | 
| 
      
 44 
     | 
    
         
            +
                      get(type_name)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                  DisplayTypes.register(:google_map_lat_lon, DisplayTypes::GoogleMapLatLon)
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ActionView
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 3 
     | 
    
         
            +
                module AutoTagHelper
         
     | 
| 
      
 4 
     | 
    
         
            +
                  module DisplayTypes
         
     | 
| 
      
 5 
     | 
    
         
            +
                    module GoogleMapLatLon
         
     | 
| 
      
 6 
     | 
    
         
            +
                      def self.display_tag latlon,html_options
         
     | 
| 
      
 7 
     | 
    
         
            +
                        lat = latlon[:lat]
         
     | 
| 
      
 8 
     | 
    
         
            +
                        lon = latlon[:lon]
         
     | 
| 
      
 9 
     | 
    
         
            +
                        <<RTN
         
     | 
| 
      
 10 
     | 
    
         
            +
            <iframe width="600" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.co.jp/maps?f=q&hl=ja&q=#{lat},#{lon}&t=m&om=0&ie=UTF8&oe=UTF8&ll=#{lat},#{lon}&z=17&output=embed"></iframe>
         
     | 
| 
      
 11 
     | 
    
         
            +
            RTN
         
     | 
| 
      
 12 
     | 
    
         
            +
                      end
         
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,129 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "active_support"
         
     | 
| 
      
 2 
     | 
    
         
            +
            module ActionView
         
     | 
| 
      
 3 
     | 
    
         
            +
              module Helpers
         
     | 
| 
      
 4 
     | 
    
         
            +
                module AutoTagHelper
         
     | 
| 
      
 5 
     | 
    
         
            +
                  module FormInfo
         
     | 
| 
      
 6 
     | 
    
         
            +
                    extend ActiveSupport::Concern
         
     | 
| 
      
 7 
     | 
    
         
            +
                    included do
         
     | 
| 
      
 8 
     | 
    
         
            +
                      class << self
         
     | 
| 
      
 9 
     | 
    
         
            +
                        def showable_methods
         
     | 
| 
      
 10 
     | 
    
         
            +
                          @showable_methods
         
     | 
| 
      
 11 
     | 
    
         
            +
                        end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                        def display_options(column_name)
         
     | 
| 
      
 14 
     | 
    
         
            +
                          (@display_options ||= {})[column_name.to_sym]
         
     | 
| 
      
 15 
     | 
    
         
            +
                        end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                        def input_options(column_name)
         
     | 
| 
      
 18 
     | 
    
         
            +
                          (@input_options ||= {})[column_name.to_sym]
         
     | 
| 
      
 19 
     | 
    
         
            +
                        end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                        def editable_columns
         
     | 
| 
      
 22 
     | 
    
         
            +
                          @editable_columns
         
     | 
| 
      
 23 
     | 
    
         
            +
                        end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                        def select_list(column_name)
         
     | 
| 
      
 26 
     | 
    
         
            +
                          list = (@select_list ||= {})[column_name.to_sym]
         
     | 
| 
      
 27 
     | 
    
         
            +
                          list = list.call if list && list.kind_of?(Proc)
         
     | 
| 
      
 28 
     | 
    
         
            +
                          if !list && self.respond_to?(:reflections)
         
     | 
| 
      
 29 
     | 
    
         
            +
                            relation = self.reflections[column_name.to_s.gsub(/_id$/,'')]
         
     | 
| 
      
 30 
     | 
    
         
            +
                            model = relation.klass if relation
         
     | 
| 
      
 31 
     | 
    
         
            +
                            list = model.all.to_a if model
         
     | 
| 
      
 32 
     | 
    
         
            +
                          end
         
     | 
| 
      
 33 
     | 
    
         
            +
                          list
         
     | 
| 
      
 34 
     | 
    
         
            +
                        end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                        protected
         
     | 
| 
      
 37 
     | 
    
         
            +
                        def set_accessible_attrs(*args)
         
     | 
| 
      
 38 
     | 
    
         
            +
                          set_showable_methods(*args)
         
     | 
| 
      
 39 
     | 
    
         
            +
                          set_editable_columns(*args)
         
     | 
| 
      
 40 
     | 
    
         
            +
                        end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                        def set_editable_columns(*args)
         
     | 
| 
      
 43 
     | 
    
         
            +
                          if args.present?
         
     | 
| 
      
 44 
     | 
    
         
            +
                            ( @editable_columns ||= [] ).concat(args.map(&:to_sym)).uniq!
         
     | 
| 
      
 45 
     | 
    
         
            +
                          end
         
     | 
| 
      
 46 
     | 
    
         
            +
                          @editable_columns
         
     | 
| 
      
 47 
     | 
    
         
            +
                        end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                        def clear_editable_methods
         
     | 
| 
      
 50 
     | 
    
         
            +
                          @editable_columns = nil
         
     | 
| 
      
 51 
     | 
    
         
            +
                        end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                        def set_select_list(column,list=nil,&block)
         
     | 
| 
      
 54 
     | 
    
         
            +
                          (@select_list ||= {})[column.to_sym] = (block || list)
         
     | 
| 
      
 55 
     | 
    
         
            +
                        end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                        def set_showable_methods(*args)
         
     | 
| 
      
 58 
     | 
    
         
            +
                          if args.present?
         
     | 
| 
      
 59 
     | 
    
         
            +
                            ( @showable_methods ||= [] ).concat(args.map(&:to_sym)).uniq!
         
     | 
| 
      
 60 
     | 
    
         
            +
                          end
         
     | 
| 
      
 61 
     | 
    
         
            +
                          @showable_methods
         
     | 
| 
      
 62 
     | 
    
         
            +
                        end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                        def clear_showable_methods
         
     | 
| 
      
 65 
     | 
    
         
            +
                          @showable_methods = nil
         
     | 
| 
      
 66 
     | 
    
         
            +
                        end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                        # Starts a form tag that points the action to an url configured with <tt>url_for_options</tt> just like
         
     | 
| 
      
 69 
     | 
    
         
            +
                        # ActionController::Base#url_for. The method for the form defaults to POST.
         
     | 
| 
      
 70 
     | 
    
         
            +
                        #
         
     | 
| 
      
 71 
     | 
    
         
            +
                        # ==== Parameters:
         
     | 
| 
      
 72 
     | 
    
         
            +
                        # column_name::
         
     | 
| 
      
 73 
     | 
    
         
            +
                        #   Target column name
         
     | 
| 
      
 74 
     | 
    
         
            +
                        # ==== Options
         
     | 
| 
      
 75 
     | 
    
         
            +
                        # * <tt>:method</tt> - called method name
         
     | 
| 
      
 76 
     | 
    
         
            +
                        # * <tt>:type</tt> - display type
         
     | 
| 
      
 77 
     | 
    
         
            +
                        # * Any other key creates standard HTML attributes for the tag.
         
     | 
| 
      
 78 
     | 
    
         
            +
                        #
         
     | 
| 
      
 79 
     | 
    
         
            +
                        # ==== Examples
         
     | 
| 
      
 80 
     | 
    
         
            +
                        #   class User < ActiveRecord::Base
         
     | 
| 
      
 81 
     | 
    
         
            +
                        #     include ActionView::Helpers::AutoTagHelper::FormInfo
         
     | 
| 
      
 82 
     | 
    
         
            +
                        #     set_display_options('my_photo_url',method: :image_tag, args: ->(v,rec){ [v,{ width: 64px, height: 64px }] })
         
     | 
| 
      
 83 
     | 
    
         
            +
                        #     set_display_options('myhome_latlot',type: :latlot}
         
     | 
| 
      
 84 
     | 
    
         
            +
                        #     def myhome_latlot
         
     | 
| 
      
 85 
     | 
    
         
            +
                        #       {lat: self.my_home_lat, lot: self.my_home_lot}
         
     | 
| 
      
 86 
     | 
    
         
            +
                        #     end
         
     | 
| 
      
 87 
     | 
    
         
            +
                        #   end
         
     | 
| 
      
 88 
     | 
    
         
            +
                        #
         
     | 
| 
      
 89 
     | 
    
         
            +
                        #   module LatLon
         
     | 
| 
      
 90 
     | 
    
         
            +
                        #     def self.display_tag latlon,html_options
         
     | 
| 
      
 91 
     | 
    
         
            +
                        #       lat = latlon[:lat]
         
     | 
| 
      
 92 
     | 
    
         
            +
                        #       lon = latlon[:lon]
         
     | 
| 
      
 93 
     | 
    
         
            +
                        #       "<div>lat: #{lat}, lon: #{lon}</div>"
         
     | 
| 
      
 94 
     | 
    
         
            +
                        #     end
         
     | 
| 
      
 95 
     | 
    
         
            +
                        #   end
         
     | 
| 
      
 96 
     | 
    
         
            +
                        #   ActionView::Helpers::AutoTagHelper::DisplayTypes.register(:latlon, LatLon)
         
     | 
| 
      
 97 
     | 
    
         
            +
                        #
         
     | 
| 
      
 98 
     | 
    
         
            +
                        #   user = User.find(1)
         
     | 
| 
      
 99 
     | 
    
         
            +
                        #   puts user # => #<User id: 1, email: "myemail@gmail.com", my_photo_url: "https://mywebsite.com/user/1/photo.jpg", my_home_lot: 139.691706, my_home_lat: 35.689487>
         
     | 
| 
      
 100 
     | 
    
         
            +
                        #   display_tag(:my_photo_url, user)
         
     | 
| 
      
 101 
     | 
    
         
            +
                        #     # => image_tag("https://mywebsite.com/user/1/photo.jpg", {width: '64px', height: '64px'})
         
     | 
| 
      
 102 
     | 
    
         
            +
                        #
         
     | 
| 
      
 103 
     | 
    
         
            +
                        #   display_tag(:my_photo_url, user, width: '128px', height: '128px')
         
     | 
| 
      
 104 
     | 
    
         
            +
                        #     # => image_tag("https://mywebsite.com/user/1/photo.jpg", {width: '128px', height: '128px'})
         
     | 
| 
      
 105 
     | 
    
         
            +
                        #
         
     | 
| 
      
 106 
     | 
    
         
            +
                        #   display_tag('myhome_latlot', user)
         
     | 
| 
      
 107 
     | 
    
         
            +
                        #     # => <div>lat: 35.689487, lon: 139.691706</div>
         
     | 
| 
      
 108 
     | 
    
         
            +
                        #
         
     | 
| 
      
 109 
     | 
    
         
            +
                        def set_display_options(column_name,options)
         
     | 
| 
      
 110 
     | 
    
         
            +
                          (@display_options ||= {})[column_name.to_sym] = options
         
     | 
| 
      
 111 
     | 
    
         
            +
                        end
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                        # ==== Examples
         
     | 
| 
      
 114 
     | 
    
         
            +
                        #   set_input_options :hoge_crypted_password, type: :password, maxlength: 8
         
     | 
| 
      
 115 
     | 
    
         
            +
                        #   set_input_options :hoge_percent, type: :range, min: 0, max: 100
         
     | 
| 
      
 116 
     | 
    
         
            +
                        # ==== Enable combinations of column's type and input type
         
     | 
| 
      
 117 
     | 
    
         
            +
                        # * <tt>datetime</tt> - :datetime_local
         
     | 
| 
      
 118 
     | 
    
         
            +
                        # * <tt>string</tt> - :color, :email, :number, :password, :phone, :telephone, :url
         
     | 
| 
      
 119 
     | 
    
         
            +
                        # * <tt>integer</tt> - :range, :week, :month
         
     | 
| 
      
 120 
     | 
    
         
            +
                        #
         
     | 
| 
      
 121 
     | 
    
         
            +
                        def set_input_options(column_name,options)
         
     | 
| 
      
 122 
     | 
    
         
            +
                          (@input_options ||= {})[column_name.to_sym] = options
         
     | 
| 
      
 123 
     | 
    
         
            +
                        end
         
     | 
| 
      
 124 
     | 
    
         
            +
                      end
         
     | 
| 
      
 125 
     | 
    
         
            +
                    end
         
     | 
| 
      
 126 
     | 
    
         
            +
                  end
         
     | 
| 
      
 127 
     | 
    
         
            +
                end
         
     | 
| 
      
 128 
     | 
    
         
            +
              end
         
     | 
| 
      
 129 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "action_view/helpers/auto_tag_helper"
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,160 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: actionview-helpers-auto_tag_helper
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.3
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Shinjiro Itagaki
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-08-11 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.10'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: activerecord
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: sqlite3
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: actionview
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: activesupport
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: 4.2.3
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: 4.2.3
         
     | 
| 
      
 111 
     | 
    
         
            +
            description: Helper for generate input tags automatically by detect column info
         
     | 
| 
      
 112 
     | 
    
         
            +
            email:
         
     | 
| 
      
 113 
     | 
    
         
            +
            - ishinjiroster@gmail.com
         
     | 
| 
      
 114 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 115 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 116 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 117 
     | 
    
         
            +
            files:
         
     | 
| 
      
 118 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 119 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 120 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 121 
     | 
    
         
            +
            - CODE_OF_CONDUCT.md
         
     | 
| 
      
 122 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 123 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 124 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 125 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 126 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 127 
     | 
    
         
            +
            - actionview-helpers-auto_tag_helper.gemspec
         
     | 
| 
      
 128 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 129 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 130 
     | 
    
         
            +
            - lib/action_view/helpers/auto_tag_helper.rb
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/action_view/helpers/auto_tag_helper/display_types.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/action_view/helpers/auto_tag_helper/display_types/google_map.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - lib/action_view/helpers/auto_tag_helper/form_info.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib/action_view/helpers/auto_tag_helper/version.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/actionview/helpers/auto_tag_helper.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            homepage: https://github.com/baseball-bridge/actionview-helpers-auto_tag_helper
         
     | 
| 
      
 137 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 138 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 139 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 140 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 141 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 142 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 143 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 144 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 145 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 146 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 147 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 148 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 149 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 150 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 151 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 152 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 153 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 154 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 155 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 156 
     | 
    
         
            +
            rubygems_version: 2.4.5
         
     | 
| 
      
 157 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 158 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 159 
     | 
    
         
            +
            summary: Helper for generate input tags automatically
         
     | 
| 
      
 160 
     | 
    
         
            +
            test_files: []
         
     |