Code Monkey home page Code Monkey logo

kemal-flash's Introduction

kemal-flash

kemal-flash provides a way to pass temporary information between actions. Anything that's placed in the flash will be cleared out at the end of the next action. kemal-flash depends on kemal-session. Make sure kemal-session is included before including kemal-flash.

Installation

Add this to your application's shard.yml:

dependencies:
  kemal-flash:
    github: neovintage/kemal-flash
    version: 0.1.0

Usage

require "kemal"
require "kemal-session"
require "kemal-flash"

get "/" do |env|
  env.flash["notice"] = "welcome"
end

get "/check_flash" do |env|
  env.flash["notice"]?
end

Contributing

  1. Fork it ( https://github.com/[your-github-name]/kemal-flash/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

kemal-flash's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kemal-flash's Issues

Crystal 0.25.0 and Kemal 0.23.0 breaks kemal-flash

Kemal-flash doesn't seem to keep flash on redirect. I forked, updated the shards, and ran spec and got this:

Failures:

  1) Kemal::Flash should handle updates to flash
     Failure/Error: response.body.should eq("{\"values\":{\"lucy\":\"linus\"},\"discard\":[]}")

       Expected: "{\"values\":{\"lucy\":\"linus\"},\"discard\":[]}"
            got: "{\"values\":{},\"discard\":[]}"

     # spec/kemal-flash_spec.cr:20

  2) Kemal::Flash should keep flash on a redirect
     Failure/Error: response.body.should eq("302")

       Expected: "302"
            got: ""

     # spec/kemal-flash_spec.cr:25

Finished in 5.43 milliseconds
14 examples, 2 failures, 0 errors, 0 pending

Failed examples:

crystal spec spec/kemal-flash_spec.cr:15 # Kemal::Flash should handle updates to flash
crystal spec spec/kemal-flash_spec.cr:23 # Kemal::Flash should keep flash on a redirect

Are you still maintaining this shard? If so, although I'm not a developer, I would like to help. This is too cool a project to let languish, imho.

Thank you.

Repo Maintenance

Are folks still using this code? I went through a period where I didn't have much time. I'm happy to get it updated if there's interest.

Crystal 0.24.2 and flash

Is this broken with the latest Crystal version? I can't get it to work. I have kemal-sessions required first in my main application. Using Google Chrome to browse. Am I missing something basic?

get "/check_flash" do |env|
  env.flash["notice"] = "welcome"
  env.redirect "/"
end

Thanks for any insight.

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.