Giter Club home page Giter Club logo

petal_boilerplate's Introduction

Petal Boilerplate

A clean install of the Phoenix 1.7 (RC) along with:

Get up and running

Optionally change your database name in dev.exs.

  1. Setup the project with mix setup
  2. Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server
  3. Now you can visit localhost:4000 from your browser.

Phoenix 1.7 generators

The CRUD generators (eg. mix phx.gen.live) will produce code that doesn't quite work. Basically, they will use components defined in core_components.ex that we have renamed due to naming clashes with Petal Components. To fix, simply do a find and replace in the generated code:

Replace `.modal` with `.phx_modal`
Replace `.table` with `.phx_table`
Replace `.button` with `.phx_button`

This should make it work but it'll be using a different style of buttons/tables/modal to Petal Components. To work with Petal Components you will need to replace all buttons/tables/modal with the Petal Component versions.

Petal Pro currently comes with a generator to build CRUD interfaces with Petal Components. You can purchase it here.

Renaming your project

Run mix rename PetalBoilerplate YourNewName to rename your project. You can then remove {:rename_project, "~> 0.1.0", only: :dev} from your mix.exs file.

petal_boilerplate's People

Contributors

basilenouvellet avatar ethancrawford avatar mitkins avatar mplatts avatar nhobes avatar saleyn 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  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  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

petal_boilerplate's Issues

Update deps Petal components 0.9.0

Fresh template install currently gives a compilation error when using the .card Petal component

== Compilation error in file lib/inventory_web/views/page_view.ex ==
** (CompileError) lib/inventory_web/templates/page/index.html.heex:753: undefined function card/1 (expected InventoryWeb.PageView to define such a function or for it to be imported, but none are available)

Fixed updating mix.deps

{:petal_components, "~> 0.9.0"}

FYI also seems to be a CSS error with all the .card dark @layer components, but might be something I missed on setup

CssSyntaxError: tailwindcss: PETAL/assets/css/app.css:8:5: The `dark:border-gray-300` class does not exist. If `dark:border-gray-300` is a custom class, make sure it is defined within a `@layer` directive.

FunctionClauseError in PetalComponents.Button.get_color_classes/1

Hello team, trying PETAL for the first time on OSX and running into an exception. I did the following:

  1. git clone
  2. mix setup
  3. mix phx.server
  4. open localhost:4000

and then I get this:

[info] GET /
[debug] Processing with PetalBoilerplateWeb.PageController.home/2
Parameters: %{}
Pipelines: [:browser]
[info] Sent 500 in 87ms
[error] #PID<0.503.0> running Phoenix.Endpoint.SyncCodeReloadPlug (connection #PID<0.502.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /
** (exit) an exception was raised:
** (FunctionClauseError) no function clause matching in PetalComponents.Button.get_color_classes/1
(petal_components 1.3.0) lib/petal_components/button.ex:169: PetalComponents.Button.get_color_classes(%{disabled: false, size: "md", loading: false, color: "dark", variant: "solid", with_icon: false, user_added_classes: ""})
(petal_components 1.3.0) lib/petal_components/button.ex:149: PetalComponents.Button.button_classes/1
(petal_components 1.3.0) lib/petal_components/button.ex:59: PetalComponents.Button."button (overridable 1)"/1
(phoenix_live_view 0.19.5) lib/phoenix_live_view/tag_engine.ex:68: Phoenix.LiveView.TagEngine.component/3
(petal_boilerplate 0.1.0) lib/petal_boilerplate_web/controllers/page_html/home.html.heex:107: anonymous fn/2 in PetalBoilerplateWeb.PageHTML.home/1
(phoenix_live_view 0.19.5) lib/phoenix_live_view/engine.ex:150: Phoenix.HTML.Safe.Phoenix.LiveView.Rendered.to_iodata/1
(phoenix_live_view 0.19.5) lib/phoenix_live_view/engine.ex:166: Phoenix.HTML.Safe.Phoenix.LiveView.Rendered.to_iodata/3
(phoenix 1.7.7) lib/phoenix/controller.ex:1008: anonymous fn/5 in Phoenix.Controller.template_render_to_iodata/4
(telemetry 1.2.1) /Users/rsas/elixir/petal_boilerplate/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix 1.7.7) lib/phoenix/controller.ex:974: Phoenix.Controller.render_and_send/4
(petal_boilerplate 0.1.0) lib/petal_boilerplate_web/controllers/page_controller.ex:1: PetalBoilerplateWeb.PageController.action/2
(petal_boilerplate 0.1.0) lib/petal_boilerplate_web/controllers/page_controller.ex:1: PetalBoilerplateWeb.PageController.phoenix_controller_pipeline/2
(phoenix 1.7.7) lib/phoenix/router.ex:430: Phoenix.Router.call/5
(petal_boilerplate 0.1.0) lib/petal_boilerplate_web/endpoint.ex:1: PetalBoilerplateWeb.Endpoint.plug_builder_call/2
(petal_boilerplate 0.1.0) deps/plug/lib/plug/debugger.ex:136: PetalBoilerplateWeb.Endpoint."call (overridable 3)"/2
(petal_boilerplate 0.1.0) lib/petal_boilerplate_web/endpoint.ex:1: PetalBoilerplateWeb.Endpoint.call/2
(phoenix 1.7.7) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
(cowboy 2.10.0) /Users/rsas/elixir/petal_boilerplate/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.10.0) /Users/rsas/elixir/petal_boilerplate/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3

Tailwind imports

Hi there,

I'm not experienced enough yet with all this stuff to be sure that a PR is a good idea here, but locally in my app.css I had to modify the following:

@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

to

@tailwind base;
@tailwind components;
@tailwind utilities;

I'm not sure why that was necessary - perhaps I'm using a different version of tailwind? To be clear, I wasn't using this boiler project directly, rather using it as a "cheat sheet" to figure out what to add where.

Anyway, just thought I'd mention it and also say thanks for all the work on this!

mix setup fails

Cloned the template and on mix setup I get this

==> petal_boilerplate
Compiling 17 files (.ex)
error: undefined function vertical_menu/1 (expected PetalBoilerplateWeb.PageHTML to define such a function or for it to be imported, but none are available)
  lib/petal_boilerplate_web/controllers/page_html/home.html.heex:1457: PetalBoilerplateWeb.PageHTML.home/1

error: undefined function vertical_menu/1 (expected PetalBoilerplateWeb.PageHTML to define such a function or for it to be imported, but none are available)
  lib/petal_boilerplate_web/controllers/page_html/home.html.heex:1481: PetalBoilerplateWeb.PageHTML.home/1

error: undefined function user_dropdown_menu/1 (expected PetalBoilerplateWeb.PageHTML to define such a function or for it to be imported, but none are available)
  lib/petal_boilerplate_web/controllers/page_html/home.html.heex:1529: PetalBoilerplateWeb.PageHTML.home/1

set "SameSite" to "Strict" for session cookies

According to various browser console messages, cookies will very soon need to have the SameSite attribute set to deliver cookies across sites. Here is an example of the ones in Chrome (which also includes the solution). I've also seen these in Firefox as well,

I'm pretty sure there's really no legitimate reason to forward these across sites anyways, so setting this to "strict" just applies the security policy we should probably have anyways. Best case, more secure. Worst case, at least we're making the console less noisy for devs.

It looks like all we need to do is append extra: "SameSite=Strict" to the @session_options here.

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.