Current section
37 Versions
Jump to
Current section
37 Versions
Compare versions
8
files changed
+152
additions
-96
deletions
| @@ -1,48 +1,89 @@ | |
| 1 1 | # Thesis |
| 2 2 | |
| 3 3 | <p align="center"> |
| 4 | - A CMS for Elixir/Phoenix that doesn't hijack your development workflow. |
| 5 4 | <br/> |
| 6 | - |
| 7 | - <a href="https://gitter.im/infinitered/thesis-phoenix?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/infinitered/thesis-phoenix.svg" alt="Join the chat at https://gitter.im/infinitered/thesis-phoenix"></a> |
| 5 | + <a href="http://community.infinite.red/"> |
| 6 | + <img src="https://infiniteredcommunity.herokuapp.com/badge.svg"> |
| 7 | + </a> |
| 8 8 | <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat" alt="js-standard-style"/> |
| 9 9 | <a href="https://semaphoreci.com/ir/thesis-phoenix"><img alt="Build Status" src="https://semaphoreci.com/api/v1/projects/0540dbb0-887a-45dd-9190-baa19b2ca9fb/816876/badge.svg"></a> |
| 10 | + <br/> |
| 11 | + <br/> |
| 10 12 | </p> |
| 11 13 | |
| 12 | - Thesis is a lightweight and flexible Elixir/Phoenix CMS for quickly and easily |
| 13 | - adding content editing to any page on a Phoenix website, as well as creating new |
| 14 | - dynamically routed pages. It's ideal for either adding limited editing support to |
| 15 | - existing Phoenix websites or building dynamic websites. |
| 14 | + <table> |
| 15 | + <tr><td><h4>What Is Thesis?</h4></td></tr> |
| 16 | + <tr> |
| 17 | + <td> |
| 18 | + A CMS for Elixir/Phoenix that doesn't hijack your development workflow. |
| 19 | + <br/> |
| 20 | + <br/> |
| 21 | + Thesis is a lightweight and flexible Elixir/Phoenix CMS for quickly and easily |
| 22 | + adding content editing to any page on a Phoenix website, as well as creating new |
| 23 | + dynamically routed pages. It's ideal for either adding limited editing support to |
| 24 | + existing Phoenix websites or building dynamic websites. |
| 25 | + <br/> |
| 26 | + <br/> |
| 27 | + </td> |
| 28 | + </tr> |
| 16 29 | |
| 17 | - _Thesis is currently considered *Alpha-quality*, but is in production on several |
| 18 | - websites, including [Infinite Red](https://infinite.red). The API is unstable and |
| 19 | - changing but we are committed to providing a clear upgrade path and documentation._ |
| 30 | + <tr><td><h4>Thesis Features</h4></td></tr> |
| 31 | + <tr> |
| 32 | + <td> |
| 33 | + <ul> |
| 34 | + <li>Elixir/Phoenix hex package, uses React.js for its user interface</li> |
| 35 | + <li>Lightweight, bolt-on, doesn't hijack your development workflow</li> |
| 36 | + <li>On-page rich text editing</li> |
| 37 | + <li>On-page plain text editing</li> |
| 38 | + <li>Raw HTML editing for Youtube embeds or other flexible uses</li> |
| 39 | + <li>Image URL editing, both `img` tag and `div` with background image</li> |
| 40 | + <li>Page meta title and description editing</li> |
| 41 | + <li>Easily bring your own authentication system in one tiny function</li> |
| 42 | + <li>Create new dynamic pages, delete dynamic pages</li> |
| 43 | + </ul> |
| 44 | + </td> |
| 45 | + </tr> |
| 20 46 | |
| 21 | - _See also the Thesis [Rails gem](https://github.com/infinitered/thesis-rails)._ |
| 47 | + <tr><td><h4>What Thesis Isn't</h4></td></tr> |
| 48 | + <tr> |
| 49 | + <td> |
| 50 | + You can't have it all. Thesis isn't the same as other -bloated- full-function |
| 51 | + content management systems out there. This is a list of what it's not now and |
| 52 | + not likely to be in the future. |
| 53 | + <br/><br/> |
| 54 | + <ul> |
| 55 | + <li>Not a complete WordPress Replacement</li> |
| 56 | + <li>Not a full featured CMS</li> |
| 57 | + <li>Not a full featured WYSIWYG editor</li> |
| 58 | + <li>Not an authentication or permission system</li> |
| 59 | + <li>Not supported outside of a Phoenix app</li> |
| 60 | + </ul> |
| 61 | + </td> |
| 62 | + </tr> |
| 22 63 | |
| 23 | -  |
| 64 | + <tr><td><h4>Caveats</h4></td></tr> |
| 65 | + <tr> |
| 66 | + <td> |
| 67 | + Thesis is currently considered <em>Alpha-quality</em>, but is in production on several |
| 68 | + websites, including <a href="https://infinite.red">Infinite Red</a>. The API is unstable and |
| 69 | + changing but we are committed to providing a clear upgrade path and documentation. |
| 70 | + </td> |
| 71 | + </tr> |
| 72 | + </table> |
| 24 73 | |
| 25 | - ## Thesis Features |
| 74 | +  |
| 26 75 | |
| 27 | - * Elixir/Phoenix hex package, uses React.js for its user interface |
| 28 | - * Lightweight, bolt-on, doesn't hijack your development workflow |
| 29 | - * On-page rich text editing |
| 30 | - * On-page plain text editing |
| 31 | - * Raw HTML editing for Youtube embeds or other flexible uses |
| 32 | - * Image URL editing, both `img` tag and `div` with background image |
| 33 | - * Page meta title and description editing |
| 34 | - * Easily bring your own authentication system in one tiny function |
| 35 | - * Create new dynamic pages, delete dynamic pages |
| 76 | + --- |
| 36 77 | |
| 37 | - ## Installation and Configuration |
| 78 | + #  |
| 38 79 | |
| 39 | - _If you are having problems, view `README_INSTALL.md` for manual instructions._ |
| 80 | + *If you are having problems, view `README_INSTALL.md` for manual instructions.* |
| 40 81 | |
| 41 | - #### 1. Add thesis to your `mix.exs`: |
| 82 | + ##### 1. Add thesis to your `mix.exs`: |
| 42 83 | |
| 43 84 | ```elixir |
| 44 85 | def deps do |
| 45 | - [{:thesis, "~> 0.0.29"}] |
| 86 | + [{:thesis, "~> 0.0.30"}] |
| 46 87 | end |
| 47 88 | |
| 48 89 | def application do |
| @@ -50,30 +91,36 @@ def application do | |
| 50 91 | end |
| 51 92 | ``` |
| 52 93 | |
| 53 | - #### 2. Run `mix thesis.install` |
| 94 | + ##### 2. Run `mix thesis.install` |
| 54 95 | |
| 55 96 | This install script will add Thesis to your `config.exs` and `web.ex`, as well |
| 56 97 | as generate migrations and an authorization module in your `lib/thesis_auth.ex`. |
| 57 98 | |
| 58 | - #### 3. Add the Thesis editor to your layout |
| 99 | + ##### 3. Add the Thesis editor to your layout |
| 59 100 | |
| 60 101 | ```eex |
| 61 102 | <body> |
| 62 103 | <%= thesis_editor(@conn) %> |
| 63 104 | ``` |
| 64 105 | |
| 65 | - #### 4. Run `mix ecto.migrate` |
| 106 | + ##### 4. Run `mix ecto.migrate` |
| 66 107 | |
| 67 108 | ``` |
| 68 109 | $ mix ecto.migrate |
| 69 110 | ``` |
| 111 | + <br/> |
| 70 112 | |
| 71 | - ## Demo App |
| 113 | + --- |
| 114 | + |
| 115 | + #  |
| 72 116 | |
| 73 117 | Check out the example app in `apps/example` to see how Thesis can be implemented. |
| 74 118 | We'll keep this up to date with examples of the latest features as we develop Thesis. |
| 119 | + <br/> |
| 75 120 | |
| 76 | - ## Making Pages Editable |
| 121 | + --- |
| 122 | + |
| 123 | + #  |
| 77 124 | |
| 78 125 | Use the `Thesis.View.content/4` view helper function to make a content area |
| 79 126 | editable. If you have `use Thesis.View` in your `web.ex` file, this function |
| @@ -82,7 +129,7 @@ is already available on all of your views. | |
| 82 129 | Thesis will add a wrapper `<div>` around editable HTML and plain-text content |
| 83 130 | areas, both in read mode and edit mode, so plan your CSS accordingly. |
| 84 131 | |
| 85 | - ### Rich Text Areas |
| 132 | + # Rich Text Areas |
| 86 133 | |
| 87 134 | Simply wrap your HTML in a `content` function call, specifying `html` as the content type. |
| 88 135 | |
| @@ -103,8 +150,11 @@ becomes... | |
| 103 150 | </p> |
| 104 151 | <% end %> |
| 105 152 | ``` |
| 153 | + <br/> |
| 106 154 | |
| 107 | - ### Plain Text Areas |
| 155 | + --- |
| 156 | + |
| 157 | + # Plain Text Areas |
| 108 158 | |
| 109 159 | For plain-text, provide a `do:` option for default text. |
| 110 160 | |
| @@ -117,8 +167,11 @@ becomes... | |
| 117 167 | ```eex |
| 118 168 | <h1><%= content(@conn, "Title identifier", :text, do: "My Title") %></h1> |
| 119 169 | ``` |
| 170 | + <br/> |
| 120 171 | |
| 121 | - ### Custom HTML Areas |
| 172 | + --- |
| 173 | + |
| 174 | + # Custom HTML Areas |
| 122 175 | |
| 123 176 | For video embeds, iframes, and any other custom HTML, use the `:raw_html` content type: |
| 124 177 | |
| @@ -133,8 +186,11 @@ becomes... | |
| 133 186 | <iframe width="560" height="315" src="https://www.youtube.com/embed/5SVLs_NN_uY" frameborder="0" allowfullscreen></iframe> |
| 134 187 | <% end %> |
| 135 188 | ``` |
| 189 | + <br/> |
| 136 190 | |
| 137 | - ### Images (by URL) |
| 191 | + --- |
| 192 | + |
| 193 | + # Images |
| 138 194 | |
| 139 195 | You can have the user specify an image URL and display the image with the `image` content type. |
| 140 196 | |
| @@ -164,7 +220,7 @@ becomes... | |
| 164 220 | ### Image Uploads |
| 165 221 | |
| 166 222 | Thesis offers support for a few different ways to handle image uploads: store files in the database, |
| 167 | - point to an uploader/adapter inside your custom app, or use one of the prebuilt adapters. |
| 223 | + point to an uploader/adapter inside your custom app, or use one of the prebuilt adapters (in progress). |
| 168 224 | |
| 169 225 | ##### Store Files in Database |
| 170 226 | For smaller websites and/or website that are hosted on the cloud, thesis offers a no-setup-required image uploader. |
| @@ -193,29 +249,14 @@ The module should have an `upload/1` function that accepts a `%Plug.Upload{}` st | |
| 193 249 | [/lib/thesis/uploaders/repo_uploader.ex](https://github.com/infinitered/thesis-phoenix/blob/master/lib/thesis/uploaders/repo_uploader.ex) |
| 194 250 | for an example. |
| 195 251 | |
| 196 | - ##### Use a Prebuilt Adapter |
| 197 | - Included in Thesis is an adapter for Ospry.io, which is a service that |
| 198 | - offers the first 1,000 images and 1 GB of monthly download bandwidth |
| 199 | - for free. |
| 200 | - |
| 201 | - 1. Sign up at [https://ospry.io/sign-up](https://ospry.io/sign-up) |
| 202 | - 2. Verify your email |
| 203 | - 3. Create a production subdomain (assets.example.com) |
| 204 | - 4. Add a valid credit card if you anticipate exceeding Ospry.io limits. |
| 205 | - 5. Copy your production public key to the Thesis config: |
| 206 | - |
| 207 | - ```elixir |
| 208 | - config :thesis, |
| 209 | - uploader: Thesis.OspryUploader |
| 210 | - |
| 211 | - config :thesis, Thesis.OspryUploader, |
| 212 | - ospry_public_key: "pk-prod-abcdefghijklmnopqrstuvwxyz0123456789" |
| 213 | - ``` |
| 214 252 | |
| 215 253 | That's it! Restart your server and image content areas will now contain a |
| 216 254 | file upload field. |
| 255 | + <br/> |
| 217 256 | |
| 218 | - ### Global Content Areas |
| 257 | + --- |
| 258 | + |
| 259 | + # Global Content Areas |
| 219 260 | |
| 220 261 | Content areas in Thesis are page-specific. However, if you want an editable |
| 221 262 | area that can be displayed on multiple pages, use the |
| @@ -232,7 +273,7 @@ will display the edited content across the whole website. | |
| 232 273 | <% end %> |
| 233 274 | ``` |
| 234 275 | |
| 235 | - ### Customizing the Thesis markup |
| 276 | + # Custom Classes or ID |
| 236 277 | |
| 237 278 | Thesis adds an additional `<div>` around your editable content areas. We suggest that |
| 238 279 | you not style these divs heavily, since Thesis uses them as editors and adds its own styles |
| @@ -244,8 +285,11 @@ You can provide an ID and additional classes by specifying `id` and `classes`, r | |
| 244 285 | <h1>Title</h1> |
| 245 286 | <% end %> |
| 246 287 | ``` |
| 288 | + <br/> |
| 247 289 | |
| 248 | - ### Page Meta Title and Description |
| 290 | + --- |
| 291 | + |
| 292 | + # Page Meta Title and Description |
| 249 293 | |
| 250 294 | Thesis provides a settings tray to edit each page's title and description. In your |
| 251 295 | layout, you can output the current title and description like so: |
| @@ -263,14 +307,18 @@ def about(conn, params) do | |
| 263 307 | @description = Thesis.View.page_description(conn, "A relevant description here.") |
| 264 308 | end |
| 265 309 | ``` |
| 310 | + <br/> |
| 311 | + |
| 312 | + --- |
| 313 | + |
| 314 | + #  |
| 266 315 | |
| 267 | - ## Dynamic Pages |
| 268 316 | |
| 269 317 | Thesis supports users creating and deleting dynamically routed pages. These |
| 270 318 | differ from static pages in that they are routed by Thesis rather than Phoenix, |
| 271 319 | and live only in your database. They can be rendered with different templates. |
| 272 320 | |
| 273 | -  |
| 321 | +  |
| 274 322 | |
| 275 323 | To enable dynamic pages, add (or uncomment) this in your `config/config.exs` file: |
| 276 324 | |
| @@ -314,8 +362,11 @@ routing more specifically. For example, if you want a blog section: | |
| 314 362 | |
| 315 363 | get "/blog/*path", <MyApp>.BlogController, :dynamic |
| 316 364 | ``` |
| 365 | + <br/> |
| 317 366 | |
| 318 | - ## Authorization |
| 367 | + --- |
| 368 | + |
| 369 | + #  |
| 319 370 | |
| 320 371 | You probably don't want your website editable by the world. Thesis doesn't |
| 321 372 | force you to use any particular authorization strategy. |
| @@ -372,20 +423,11 @@ defmodule MyApp.ThesisAuth do | |
| 372 423 | end |
| 373 424 | end |
| 374 425 | ``` |
| 426 | + <br/> |
| 375 427 | |
| 376 | - ## What Thesis Isn't |
| 428 | + --- |
| 377 429 | |
| 378 | - You can't have it all. Thesis isn't the same as other -bloated- full-function |
| 379 | - content management systems out there. This is a list of what it's not now and |
| 380 | - not likely to be in the future. |
| 381 | - |
| 382 | - * Not a complete WordPress Replacement |
| 383 | - * Not a full featured CMS |
| 384 | - * Not a full featured WYSIWYG editor |
| 385 | - * Not an authentication or permission system |
| 386 | - * Not supported outside of a Phoenix app |
| 387 | - |
| 388 | - ## Common Issues |
| 430 | + #  |
| 389 431 | |
| 390 432 | #### Thesis's menu/editor/tray is borked |
| 391 433 | |
| @@ -404,8 +446,11 @@ that is affecting our editor. | |
| 404 446 | In future releases, we will namespace all Thesis classes and IDs. But if your |
| 405 447 | application is overriding whole elements (like `div` or `img`), it's up to you |
| 406 448 | to fix the issue in your own CSS. |
| 449 | + <br/> |
| 407 450 | |
| 408 | - ## Contributing |
| 451 | + --- |
| 452 | + |
| 453 | + #  |
| 409 454 | |
| 410 455 | We're committed to making Thesis the go-to content editing system for Phoenix |
| 411 456 | websites. Please help us improve! |
| @@ -419,21 +464,29 @@ websites. Please help us improve! | |
| 419 464 | 7. Run `./bin/ci` in the root directory to ensure that Thesis tests pass. |
| 420 465 | 8. Push to the branch (`git push origin my-new-feature`) |
| 421 466 | 9. Create new Pull Request |
| 467 | + <br/> |
| 422 468 | |
| 423 | - ## Premium Support |
| 469 | + --- |
| 470 | + |
| 471 | + #  |
| 424 472 | |
| 425 473 | [Thesis Phoenix](https://github.com/infinitered/thesis-phoenix), as an open source project, is free to use and always will be. [Infinite Red](https://infinite.red/) offers premium Thesis Phoenix support and general web app design/development services. Email us at [hello@infinite.red](mailto:hello@infinite.red) to get in touch with us for more details. |
| 474 | + <br/> |
| 426 475 | |
| 427 | - ### Key Contributors |
| 476 | + --- |
| 428 477 | |
| 429 | - * Jamon Holmgren [@jamonholmgren](https://twitter.com/jamonholmgren) |
| 430 | - * Yulian Glukhenko [@yulolimum](https://github.com/yulolimum) |
| 431 | - * Ken Miller [@seriousken](https://github.com/kemiller) |
| 432 | - * Daniel Berkompas [@dberkom](https://twitter.com/dberkom) |
| 478 | + #  |
| 479 | + |
| 480 | + | [Jamon Holmgren](https://twitter.com/jamonholmgren) | [Yulian Glukhenko](https://github.com/yulolimum) | [Ken Miller](https://github.com/kemiller) | [Daniel Berkompas](https://twitter.com/dberkom) | |
| 481 | + | ------------- | ------------- | ------------- | ------------- | |
| 482 | + | <img src="https://infinite.red/images/avatars/img-avatar-jamon@2x.jpg" width="165"> | <img src="https://infinite.red/images/avatars/img-avatar-yulian@2x.jpg" width="165"> | <img src="https://infinite.red/images/avatars/img-avatar-ken@2x.jpg" width="165"> | <img src="https://infinite.red/images/avatars/img-avatar-daniel@2x.jpg" width="165"> | |
| 433 483 | |
| 434 484 | Also supported by others on the [Infinite Red](https://infinite.red) team. |
| 485 | + <br/> |
| 435 486 | |
| 436 | - ### License: MIT |
| 487 | + --- |
| 488 | + |
| 489 | + #  |
| 437 490 | |
| 438 491 | Copyright (c) 2016 Infinite Red, Inc. |
| @@ -6,7 +6,7 @@ For automatic setup, see `README.md`. | |
| 6 6 | |
| 7 7 | ```elixir |
| 8 8 | def deps do |
| 9 | - [{:thesis, "~> 0.0.29"}] |
| 9 | + [{:thesis, "~> 0.0.30"}] |
| 10 10 | end |
| 11 11 | |
| 12 12 | def application do |
| @@ -142,7 +142,7 @@ | |
| 142 142 | <<"README_INSTALL.md">>,<<"LICENSE.md">>,<<"package.json">>]}. |
| 143 143 | {<<"licenses">>,[<<"MIT">>]}. |
| 144 144 | {<<"links">>, |
| 145 | - [{<<"Docs">>,<<"https://hexdocs.pm/thesis/0.0.29/api-reference.html">>}, |
| 145 | + [{<<"Docs">>,<<"https://hexdocs.pm/thesis/0.0.30/api-reference.html">>}, |
| 146 146 | {<<"GitHub">>,<<"https://github.com/infinitered/thesis-phoenix">>}]}. |
| 147 147 | {<<"maintainers">>, |
| 148 148 | [<<"Jamon Holmgren">>,<<"Yulian Glukhenko">>,<<"Ken Miller">>, |
| @@ -177,4 +177,4 @@ | |
| 177 177 | {<<"name">>,<<"html_sanitize_ex">>}, |
| 178 178 | {<<"optional">>,false}, |
| 179 179 | {<<"requirement">>,<<">= 1.0.1">>}]]}. |
| 180 | - {<<"version">>,<<"0.0.29">>}. |
| 180 | + {<<"version">>,<<"0.0.30">>}. |
| @@ -90,8 +90,8 @@ defmodule Thesis.Controller.Plug do | |
| 90 90 | end |
| 91 91 | |
| 92 92 | def call(conn, _opts) do |
| 93 | - url = Thesis.Utilities.normalize_url(conn.request_path) |
| 94 | - current_page = store.page(url) |
| 93 | + path = Thesis.Utilities.normalize_path(conn.request_path) |
| 94 | + current_page = store.page(path) |
| 95 95 | page_contents = store.page_contents(current_page) |
| 96 96 | |
| 97 97 | conn |
| @@ -21,7 +21,7 @@ defmodule Thesis.EctoStore do | |
| 21 21 | |
| 22 22 | @doc """ |
| 23 23 | Calls page_contents/1 passing through either: |
| 24 | - - ```nil`, if the Page could not be found (usually means page has not been edited) |
| 24 | + - `nil`, if the Page could not be found (usually means page has not been edited) |
| 25 25 | - `%Page{...}` struct, if the Page has already been edited and saved |
| 26 26 | """ |
| 27 27 | def page_contents(slug) when is_binary(slug) do |
Loading more files…