Code Monkey home page Code Monkey logo

painless_partials's Introduction

PainlessPartials

In case when we need to override some partial which may be plased in some engine-gem it may be painfull to findout which partial are rendered in certain place.

For this purposes created gem painless_partials. It aimed to:

  • as-minimum: markup html/xml by comments with partial paths (done)

  • as-maximum: provide service for coping partial from gem into main app (50% done) or into some extension (site-theme and so on)

It is usefurl, for example, in development of application based on spree.

Works with Rails 3.0+

Usage

Add gem into Gemfile

gem 'painless_partials'

or

gem 'painless_partials', :git => 'git://github.com/x2es/painless_partials.git'

Example

Just open page source in browser and find comment “TEMPLATE /path/to/partial.html.erb” placed above code which you want to override. For example:

<!-- TEMPLATE: /usr/local/rvm/gems/[email protected]/gems/spree_core-0.30.1/app/views/shared/_google_analytics.html.erb -->

Also painless_partials gives tip about how to override partial. For example:

<!-- 
   For overriding this partial you may run from project (or engine/extension) dir:
    $ mkdir -p app/views/shared && cp /usr/local/rvm/gems/ruby-1.9.2-p0@awesome-gemset/gems/spree_core-0.30.1/app/views/shared/_google_analytics.html.erb app/views/shared/_google_analytics.html.erb
   NOTE: Please make sure that it is what you want before running. In common case it is.
-->

In common case all you need it to point project or engine/extension dir in your therminal and invoke this command.

Tip will be shown only for “foreign” sources. “Foreign” means - sources placed outside “#{Rails.root}/../”. So if you develop extensions placed in #{Rails.root}/../my-extensions/ - tip does not appears for this sources.

Inspirited by

Also good partials helper with javascript ui: github.com/markevans/partial_identifier

Issues & TODO

See github.com/x2es/painless_partials/issues

painless_partials's People

Contributors

x2es avatar

Watchers

 avatar  avatar

painless_partials's Issues

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.