Git Product home page Git Product logo

activeadmin-globalize3-inputs's Introduction

This small hack implements has_many friendly Globalize3 helper for ActiveAdmin.

Admittedly it generates structure that jQueryUI tabs() expect. However the whole idea is pretty simple and you should be able to change it to suit your needs.

Installation

Add this line to your application's Gemfile:

gem 'ActiveAdmin-Globalize3-inputs'

And then execute:

$ bundle

Usage by example

ActiveAdmin.register Gallery do
  form do |f|
    f.globalize_inputs :translations do |lf|
      lf.inputs do
        lf.input :title
        lf.input :description

        lf.input :locale, :as => :hidden
      end
    end

    f.has_many :photos do |photo|
      photo.inputs do
        photo.input :image, :as => :file
      end

      photo.globalize_inputs :translations do |lp|
        lp.inputs do
          lp.input :description

          lp.input :locale, :as => :hidden
        end
      end
    end

    f.buttons
  end
end

As you can see, there's no special option for locales. The list is taken from I18n.available_locales, so you'd probably want to define the locales your application works with somewhere.

Contributing

  1. Fork
  2. Invent better name
  3. Improve
  4. Enjoy

activeadmin-globalize3-inputs's People

Contributors

slotos avatar tatze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

activeadmin-globalize3-inputs's Issues

unexpected token &

On page load in active admin with a form with the gem:

Chrome console says:
Uncaught SyntaxError: Unexpected token & - new:89 -> line 89.

Line 89:

 <script type="text/javascript">$(&#x27;.language-tabs-Competition-69838859737240&#x27;).tabs();</script>

That script is auto generated by the gem. Any workaround?

Release it as gem, please

@Slotos, using git version is not cool. And you know what is cool? Using rubygems version!

And I think that lowercase 'activeadmin-globalize3' would be nice name for this.

undefined method `perform_browser_validations'

Hi

I tried to add ActiveAdmin-Globalize3-inputs to my project but I get the following error:

undefined method `perform_browser_validations' for Formtastic::FormBuilder:Class
Extracted source (around line #5):

2:

<%= title "#{active_admin_application.site_title} Login" %>


3:
4: <% scope = Devise::Mapping.find_scope!(resource_name) %>
5: <%= active_admin_form_for(resource, :as => resource_name, :url => send(:"#{scope}_session_path"), :html => { :id => "session_new" }) do |f|
6: f.inputs do
7: Devise.authentication_keys.each { |key| f.input key, :input_html => {:autofocus => true}}
8: f.input :password

I use

formtastic (2.1.1)
activeadmin (0.4.4)
ActiveAdmin-Globalize3-inputs (0.0.1)

By removing ActiveAdmin-Globalize3-inputs from my Gemfile the error goes away. Do you know what might go wrong?

Thanks
David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.