GithubHelp home page GithubHelp logo

nested_form_ui's Introduction

NestedFormUI

Getting Started

Gemfile:

gem 'nested_form_ui', '~> 0.0.1'

application.js:

//= require nested_form_ui/sortable

application.scss:

@import "nested_form_ui/sortable";

Usage

nestedFormSortable

= semantic_nested_form_for @page do |f|

  #parts.nested-form-sortable.inputs-vertical-list{ data: { association: 'parts' } }
    = f.semantic_fields_for :parts do |pf|
      .nested-form-drag.ui-icon.ui-icon-grip-dotted-vertical
      = pf.text_field :name
      = pf.hidden_field :position
      = pf.link_to_remove do
        .ui-icon.ui-icon-close

  = f.link_to_add 'Add part', :parts
  = f.actions

:javascript
  $(function(){
    $('#parts').nestedFormSortable();
  })

nestedFormSortable

nestedFormSortableTabs

= semantic_nested_form_for @page do |f|

  #parts.nested-form-sortable{ data: { association: 'parts' } }
    %ul.nested-form-nav.nested-form-tabs
      %li.nested-form-action
        = f.link_to_add 'Add part', :parts

    = f.semantic_fields_for :parts do |pf|
      = pf.inputs do
        = pf.input :name
        = pf.input :body
        = pf.input :position, as: :hidden
        = pf.hidden_field :_destroy

  = f.actions

:plain
  $(function(){
    $('#parts').nestedFormSortableTabs({
      templates: {
        tab: '<li class="tabs-tab">{{dragIcon}}<a href="\#{{id}}">{{text}}</a>{{removeIcon}}</li>',
        dragIcon: '<span class="nested-form-drag ui-icon ui-icon-grip-dotted-vertical"></span>' ,
        removeIcon: '<span class="nested-form-remove ui-icon ui-icon-close"></span>'
      }
    });
  })

nestedFormSortableTabs

Copyright

This project rocks and uses MIT-LICENSE.

nested_form_ui's People

Contributors

tb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

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.