Skip to content

twined/brando_news

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brando News

Coverage Status

Installation

Add brando_news to your list of dependencies in mix.exs:

    def deps do
      [
        {:brando, github: "twined/brando"},
+       {:brando_news, github: "twined/brando_news"}
      ]
    end

Install migrations and frontend files:

$ mix brando_news.install

Run migrations

$ mix ecto.migrate

Add to your web/router.ex:

    defmodule MyApp.Router do
      use MyApp.Web, :router
      # ...
+     import Brando.News.Routes.Admin

      scope "/admin", as: :admin do
        pipe_through :admin
        dashboard_routes   "/"
        user_routes        "/users"
+       post_routes        "/news"
      end
    end

Add to your lib/my_app.ex:

    def start(_type, _args) do
      import Supervisor.Spec, warn: false

      children = [
        # Start the endpoint when the application starts
        supervisor(MyApp.Endpoint, []),
        # Start the Ecto repository
        supervisor(MyApp.Repo, []),
        # Here you could define other workers and supervisors as children
        # worker(MyApp.Worker, [arg1, arg2, arg3]),
      ]

+     Brando.Registry.register(Brando.News)

Post gallery

If you want to add functionality to attach a gallery to a news post, you first have to install it:

  • $ mix brando_news.gallery.install
  • $ mix ecto.migrate
  • Add to your otp_app's conf/brando.exs:
    config :brando, Brando.News,
      enable_galleries: true
  • Add this popup form to your otp_app's start up:
    Brando.PopupForm.Registry.register(:gallery, "imageseries", Brando.ImageSeriesForm,
                                       gettext("Create gallery"), [:id, :slug])
  • Add to web/static/js/admin/custom.js:
    import News from './news';