Giter Club home page Giter Club logo

padrino-contrib's Introduction

padrino-contrib

Contributed Plugins and Utilities

This package includes a variety of add-on components for Padrino Framework:

  • breadcrumbs - Simple breadcrumb navigation helpers
  • exception_notifier - Send errors through mail or/and to redmine
  • auto_locale - Switch for you automatically the I18n.locale
  • flash_session - Middleware that help you in passing your session in the URI, when it should be in the cookie.
  • orm_ar_permalink - Generate permalink for a specified column on ActiveRecord
  • orm_ar_permalink_i18n - Generate permalink for a specified multi language column(s) on ActiveRecord
  • orm_ar_translate - Translate for you your ActiveRecord columns
  • orm_mm_permalink - Generate permalink for a specified column on MongoMapper
  • orm_mm_search - Full text search in MongoMapper in specified columns
  • helpers_assets_compressor - Joins and compress your js/css with yui-compressor

Use

In your Padrino project edit:

# Gemfile
gem 'padrino-contrib'

# boot.rb
require 'padrino-contrib/exception_notifier'
# require 'padrino-contrib/orm/active_record/permalink'
# require 'padrino-contrib/orm/active_record/textile'
# require 'padrino-contrib/helpers/breadcrumbs'

Padrino.load! # Remember to add contribs before that line!

# app.rb
class MyApp < Padrino::Application
  register Padrino::Contrib::ExceptionNotifier
end

padrino-contrib's People

Contributors

adam12 avatar basex avatar blakedy avatar daddye avatar dclausen avatar hongliang-goudou avatar myabc avatar namusyaka avatar nesquena avatar ortuna avatar senekis avatar signum avatar skade avatar t-yamo avatar tmsrjs avatar ujifgc avatar waydotnet avatar wikimatze avatar

Stargazers

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

Watchers

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

padrino-contrib's Issues

Usage documentation for breadcrumbs are missing

I asked on the padrino mailing list a while ago on how to use the breadcrumbs module. However the given example did not remotely work. I consider breadcrumbs an important part and would like to use it in my web applications. But even though I spent some time with the source code I'm not sure whether breadcrumbs are persisted (in the cookie session) or if the user has to do that. Also I had no luck rendering the breadcrumbs. Please give a working example. Thanks.

Find by field with locale

ex:

Post Model

field :title_en, :title_it, :title_fr
has_locale

def self.find_by_title(value=nil)
send('find_by_title_#{I18n.loale}', value)
end

errors with Padrino::Contrib::Helpers::AssetsCompressor

Using 'register Padrino::Contrib::Helpers::AssetsCompressor' in app.rb results in `block in default_configuration!': wrong number of arguments (1 for 0) error. Details are in https://gist.github.com/1237479 .

When I do 'register Padrino::Contrib::Helpers::AssetsCompressor::Helpers' in app.rb instead, then the app would run, but I do not notice any compression/bundling taking place, both in development and production environment.

What should I expect when the module functions correctly? Does it generate 'bundle' compressed file in public directory and layout helpers point at it?

New release

Padrino recently extracted breadcrumbs out into this gem, but no new padrino-contrib version is out yet to go along with it.
Actually it looks like various other additions have been made here over the last two years but haven't made their way into a release

undefined method 'path=' on start

hey guys,

i'm just getting started with padrino, but seem to be running into this error on startup when trying to use master of padrino-contrib. I'm running padrino version 0.13.1 and switching to padrino-contrib 0.1.13 I noticed this error goes away. any thoughts? I'll include my stacktrace and app file below. Thanks!

app.rb

  class App < Padrino::Application
    register Padrino::Contrib::AutoLocale
    set :locales, [:en, :ja]
    set :locale_exclusive_paths, ['/js', '/css', '/img']

Stacktrace

  ERROR -  NoMethodError - undefined method `path=' for #<Padrino::PathRouter::Route:0x00000002dfd1d8>:
 /usr/local/rvm/gems/ruby-2.2.1@soukoukai/bundler/gems/padrino-contrib-e6820a56b413/lib/padrino-contrib/auto_locale.rb:88:in `padrino_route_added'
/usr/local/rvm/gems/ruby-2.2.1@soukoukai/bundler/gems/padrino-contrib-e6820a56b413/lib/padrino-contrib/auto_locale.rb:88:in `padrino_route_added': undefined method `path=' for #<Padrino::PathRouter::Route:0x0000000353e7d0> (NoMethodError)
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/sinatra-1.4.7/lib/sinatra/base.rb:1591:in `block in invoke_hook'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/sinatra-1.4.7/lib/sinatra/base.rb:1591:in `each'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/sinatra-1.4.7/lib/sinatra/base.rb:1591:in `invoke_hook'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/application/routing.rb:555:in `route'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/application/routing.rb:357:in `get'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/application/application_setup.rb:123:in `block in default_routes'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/sinatra-1.4.7/lib/sinatra/base.rb:1411:in `configure'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/application/application_setup.rb:122:in `default_routes'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/application/application_setup.rb:40:in `setup_application!'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/mounter.rb:114:in `map_onto'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core.rb:73:in `block in application'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core.rb:73:in `each'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core.rb:73:in `application'
    from config.ru:9:in `block in <main>'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
    from config.ru:in `new'
    from config.ru:in `<main>'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/server.rb:24:in `detect_application'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/server.rb:12:in `run!'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/cli/adapter.rb:7:in `start'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/lib/padrino-core/cli/launcher.rb:30:in `start'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/gems/padrino-core-0.13.1/bin/padrino:8:in `<top (required)>'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/bin/padrino:23:in `load'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/bin/padrino:23:in `<main>'
    from /usr/local/rvm/gems/ruby-2.2.1@soukoukai/bin/ruby_executable_hooks:15:in `eval'

Unexpected error while processing request: undefined method `new'

I get this error with Padrino exception notifier after upgrade padrino

padrino 0.11.3
sinatra 1.4.3

I already configured my app.rb with padrino exception notifier and disable raise errors
disable :raise_errors
disable :show_exceptions

I put a raise 'here' to test sending mail with the exception and the delivery method is SMTP .

Backtrace

RuntimeError - here:
  /Users/senekis/Projects/my-project/app/controllers/users.rb:8:in `block (2 levels) in '
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:663:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:663:in `block in route'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:53:in `[]'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:53:in `block (3 levels) in process_destination_path'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:966:in `route_eval'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:53:in `block (2 levels) in process_destination_path'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:53:in `catch'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:53:in `block in process_destination_path'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:28:in `instance_eval'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:28:in `process_destination_path'
  (eval):2717:in `block in call'
  (eval):2707:in `catch'
  (eval):2707:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/http_router-0.11.0/lib/http_router.rb:307:in `raw_call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/http_router-0.11.0/lib/http_router.rb:161:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:1050:in `route!'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:1035:in `block in dispatch!'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/application/routing.rb:1033:in `dispatch!'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `block in call!'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `block in invoke'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `catch'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in `invoke'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:in `call!'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:870:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sass-3.2.9/lib/sass/plugin/rack.rb:54:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/reloader.rb:337:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/logger.rb:400:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1949:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `block in call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1726:in `synchronize'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/sinatra-1.4.3/lib/sinatra/base.rb:1449:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/router.rb:83:in `block in call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/router.rb:76:in `each'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/router.rb:76:in `call'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/connection.rb:81:in `block in pre_process'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/connection.rb:79:in `catch'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/connection.rb:79:in `pre_process'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/connection.rb:54:in `process'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/connection.rb:39:in `receive_data'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/backends/base.rb:63:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thin-1.5.1/lib/thin/server.rb:159:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/server.rb:45:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/server.rb:34:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/server.rb:12:in `run!'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/cli/adapter.rb:7:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/lib/padrino-core/cli/base.rb:25:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor/task.rb:27:in `run'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor/invocation.rb:120:in `invoke_task'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor.rb:344:in `dispatch'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/thor-0.17.0/lib/thor/base.rb:434:in `start'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/gems/padrino-core-0.11.3/bin/padrino:9:in `'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/bin/padrino:23:in `load'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/bin/padrino:23:in `'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
  /Users/senekis/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `'
  ERROR -  RuntimeError - here:
  

---Params:

"splat" => []
"captures" => [#]
!! Unexpected error while processing request: undefined method `new' for #

Suggestion: Set default layout for exceptions to :application

When creating a new Padrino project the default layout name is set to :application

However when using the exception-notifier the layout that is used to display an exception page to the user is :layout
(/lib/padrino-contrib/exception_notifier.rb)

I would like to suggest setting the default to :application, too.

breadcrumbs

Hi,

i'm trying to use padrino-contrib/helpers/breadcrumbs where i could find an example?

thanks
Federico

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.