Current section

37 Versions

Jump to

Compare versions

32 files changed
+313 additions
-210 deletions
  @@ -1,6 +1,13 @@
1 1 # Thesis
2 2
3 - [![Build Status](https://semaphoreci.com/api/v1/projects/0540dbb0-887a-45dd-9190-baa19b2ca9fb/816876/badge.svg)](https://semaphoreci.com/ir/thesis-phoenix)
3 + <p align="center">
4 + A CMS for Elixir/Phoenix that doesn't hijack your development workflow.
5 + <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>
8 + <img src=https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat alt='js-standard-style'/>
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 + </p>
4 11
5 12 Thesis is a lightweight and flexible Elixir/Phoenix CMS for quickly and easily
6 13 adding content editing to any page on a Phoenix website, as well as creating new
  @@ -31,7 +38,7 @@ _If you are having problems, view `README_INSTALL.md` for manual instructions._
31 38
32 39 ```elixir
33 40 def deps do
34 - [{:thesis, "~> 0.0.22"}]
41 + [{:thesis, "~> 0.0.23"}]
35 42 end
36 43
37 44 def application do
  @@ -57,6 +64,11 @@ as generate migrations and an authorization module in your `lib/thesis_auth.ex`.
57 64 $ mix ecto.migrate
58 65 ```
59 66
67 + ## Demo App
68 +
69 + Check out the example app in `apps/example` to see how Thesis can be implemented.
70 + We'll keep this up to date with examples of the latest features as we develop Thesis.
71 +
60 72 ## Making Pages Editable
61 73
62 74 Use the `Thesis.View.content/4` view helper function to make a content area
  @@ -228,7 +240,7 @@ To enable dynamic pages, add (or uncomment) this in your `config/config.exs` fil
228 240
229 241 ```elixir
230 242 config :thesis, :dynamic_pages,
231 - view: <MyApp>.DynamicView,
243 + view: <MyApp>.PageView,
232 244 templates: ["index.html", "otherview.html"],
233 245 not_found_view: <MyApp>.ErrorView,
234 246 not_found_template: "404.html"
  @@ -336,6 +348,26 @@ not likely to be in the future.
336 348 * Not an authentication or permission system
337 349 * Not supported outside of a Phoenix app
338 350
351 + ## Common Issues
352 +
353 + #### Thesis's menu/editor/tray is borked
354 +
355 + This is pretty common. While we try to be good citizens by properly namespacing
356 + all Thesis elements, we embed Thesis code into your existing web page, and so
357 + we're at the mercy of your application's existing CSS.
358 +
359 + Inspect the element(s) that are screwed up and see if any of your styles are
360 + conflicting. For example, here's a screenshot of an issue:
361 +
362 + [borked Thesis editor](https://cloud.githubusercontent.com/assets/1479215/18256127/223706ca-7366-11e6-971e-018ef8e656cb.png)
363 +
364 + Note that there is a `.tooltip` CSS rule originating in a different CSS file
365 + that is affecting our editor.
366 +
367 + In future releases, we will namespace all Thesis classes and IDs. But if your
368 + application is overriding whole elements (like `div` or `img`), it's up to you
369 + to fix the issue in your own CSS.
370 +
339 371 ## Contributing
340 372
341 373 We're committed to making Thesis the go-to content editing system for Phoenix
  @@ -345,17 +377,18 @@ websites. Please help us improve!
345 377 2. Create your feature branch (`git checkout -b my-new-feature`)
346 378 3. Commit your changes (`git commit -am 'Add some feature'`)
347 379 4. Run `brunch watch -p` during development
348 - 5. Write tests for your new feature
349 - 6. Run `mix test` in the root directory to ensure that all tests pass.
350 - 7. Push to the branch (`git push origin my-new-feature`)
351 - 8. Create new Pull Request
380 + 5. Use the `apps/example` Phoenix app to manually test your feature
381 + 6. Write tests for your new feature
382 + 7. Run `mix test` in the root directory to ensure that all tests pass.
383 + 8. Push to the branch (`git push origin my-new-feature`)
384 + 9. Create new Pull Request
352 385
353 386 ### Key Contributors
354 387
355 388 * Jamon Holmgren [@jamonholmgren](https://twitter.com/jamonholmgren)
389 + * Yulian Glukhenko [@yulianglukhenko](https://github.com/yulianglukhenko)
356 390 * Ken Miller [@seriousken](https://github.com/kemiller)
357 391 * Daniel Berkompas [@dberkom](https://twitter.com/dberkom)
358 - * Yulian Glukhenko [@yulianglukhenko](https://github.com/yulianglukhenko)
359 392
360 393 Also supported by others on the [Infinite Red](https://infinite.red) team.
  @@ -6,7 +6,7 @@ For automatic setup, see `README.md`.
6 6
7 7 ```elixir
8 8 def deps do
9 - [{:thesis, "~> 0.0.22"}]
9 + [{:thesis, "~> 0.0.23"}]
10 10 end
11 11
12 12 def application do
  @@ -25,7 +25,7 @@ config :thesis,
25 25 config :thesis, Thesis.EctoStore, repo: <MyApp>.Repo
26 26 # If you want to allow creating dynamic pages:
27 27 # config :thesis, :dynamic_pages,
28 - # view: <MyApp>.DynamicView,
28 + # view: <MyApp>.PageView,
29 29 # templates: ["index.html", "otherview.html"],
30 30 # not_found_view: <MyApp>.ErrorView,
31 31 # not_found_template: "404.html"
  @@ -50,6 +50,7 @@ end
50 50
51 51 ```elixir
52 52 defmodule <MyApp>.Repo.Migrations.CreateThesisTables do
53 + @moduledoc false
53 54 use Ecto.Migration
54 55
55 56 def change do
  @@ -133,10 +133,11 @@
133 133 <<"README_INSTALL.md">>,<<"LICENSE.md">>,<<"package.json">>]}.
134 134 {<<"licenses">>,[<<"MIT">>]}.
135 135 {<<"links">>,
136 - [{<<"Docs">>,<<"https://hexdocs.pm/thesis/0.0.22/api-reference.html">>},
137 - {<<"GitHub">>,<<"https://github.com/infinite_red/thesis">>}]}.
136 + [{<<"Docs">>,<<"https://hexdocs.pm/thesis/0.0.23/api-reference.html">>},
137 + {<<"GitHub">>,<<"https://github.com/infinitered/thesis">>}]}.
138 138 {<<"maintainers">>,
139 - [<<"Jamon Holmgren">>,<<"Ken Miller">>,<<"Daniel Berkompas">>]}.
139 + [<<"Jamon Holmgren">>,<<"Ken Miller">>,<<"Daniel Berkompas">>,
140 + <<"Yulian Glukhenko">>]}.
140 141 {<<"name">>,<<"thesis">>}.
141 142 {<<"requirements">>,
142 143 [[{<<"app">>,<<"phoenix">>},
  @@ -163,4 +164,4 @@
163 164 {<<"name">>,<<"html_sanitize_ex">>},
164 165 {<<"optional">>,false},
165 166 {<<"requirement">>,<<">= 1.0.1">>}]]}.
166 - {<<"version">>,<<"0.0.22">>}.
167 + {<<"version">>,<<"0.0.23">>}.
  @@ -9,7 +9,7 @@ defmodule Mix.Tasks.Thesis.Install do
9 9 "add_template_and_redirect_url_to_thesis_pages"
10 10 ]
11 11 @template_files [
12 - {"priv/templates/thesis.install/thesis_auth.exs", "lib/thesis_auth.ex" }
12 + {"priv/templates/thesis.install/thesis_auth.exs", "lib/thesis_auth.ex"}
13 13 ]
14 14
15 15 @shortdoc "Generates Thesis code in your Phoenix app"
  @@ -43,7 +43,7 @@ defmodule Mix.Tasks.Thesis.Install do
43 43 |> Enum.with_index
44 44 |> Enum.map(&migration_tuple/1)
45 45
46 - @template_files ++ migration_files
46 + (@template_files ++ migration_files)
47 47 |> Stream.map(&render_eex/1)
48 48 |> Stream.map(&copy_to_target/1)
49 49 |> Stream.run
  @@ -53,7 +53,8 @@ defmodule Mix.Tasks.Thesis.Install do
53 53 def thesis_config do
54 54 status_msg("updating", "config/config.exs")
55 55 dest_file_path = Path.join [File.cwd! | ~w(config config.exs)]
56 - File.read!(dest_file_path)
56 + dest_file_path
57 + |> File.read!()
57 58 |> insert_thesis
58 59 |> overwrite_file(dest_file_path)
59 60 end
  @@ -62,7 +63,8 @@ defmodule Mix.Tasks.Thesis.Install do
62 63 def thesis_web do
63 64 status_msg("updating", "web/web.exs")
64 65 dest_file_path = Path.join [File.cwd! | ~w(web web.ex)]
65 - File.read!(dest_file_path)
66 + dest_file_path
67 + |> File.read!()
66 68 |> insert_controller
67 69 |> insert_view
68 70 |> insert_router
  @@ -82,15 +84,18 @@ defmodule Mix.Tasks.Thesis.Install do
82 84 end
83 85
84 86 defp insert_at(source, pattern, inserted) do
85 - unless String.contains?(source, inserted) do
86 - String.replace(source, pattern, pattern <> inserted)
87 - else
87 + if String.contains?(source, inserted) do
88 88 source
89 + else
90 + String.replace(source, pattern, pattern <> inserted)
89 91 end
90 92 end
91 93
92 94 defp insert_thesis(source) do
93 - unless String.contains? source, "config :thesis" do
95 + if String.contains? source, "config :thesis" do
96 + status_msg("skipping", "thesis config. It already exists.")
97 + :skip
98 + else
94 99 source <> """
95 100
96 101 # Configure thesis content editor
  @@ -100,7 +105,7 @@ defmodule Mix.Tasks.Thesis.Install do
100 105 config :thesis, Thesis.EctoStore, repo: #{Mix.Phoenix.base}.Repo
101 106 # If you want to allow creating dynamic pages:
102 107 # config :thesis, :dynamic_pages,
103 - # view: #{Mix.Phoenix.base}.DynamicView,
108 + # view: #{Mix.Phoenix.base}.PageView,
104 109 # templates: ["index.html", "otherview.html"],
105 110 # not_found_view: #{Mix.Phoenix.base}.ErrorView,
106 111 # not_found_template: "404.html"
  @@ -108,9 +113,6 @@ defmodule Mix.Tasks.Thesis.Install do
108 113 # config :thesis, Thesis.OspryUploader,
109 114 # ospry_public_key: "pk-prod-asdfasdfasdfasdfasdf"
110 115 """
111 - else
112 - status_msg("skipping", "thesis config. It already exists.")
113 - :skip
114 116 end
115 117 end
  @@ -4,7 +4,7 @@ defmodule Thesis.Auth do
4 4 interface necessary for Thesis to determine whether the current session
5 5 has the authority to edit.
6 6
7 - There is only one required functions, as described below.
7 + There is only one required function, as described below.
8 8
9 9 Ensure that your app specifies the proper module in your configuration options.
10 10 For example, in `config/config.ex`:
Loading more files…