Skip to content

Commit

Permalink
Update css and file paths to reflect nodes structure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zberkom committed Nov 10, 2016
1 parent 8b37449 commit 872cb3b
Show file tree
Hide file tree
Showing 16 changed files with 3,189 additions and 88 deletions.
6 changes: 3 additions & 3 deletions apps/example/mix.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
%{"certifi": {:hex, :certifi, "0.7.0", "861a57f3808f7eb0c2d1802afeaae0fa5de813b0df0979153cbafcd853ababaf", [:rebar3], []},
"combine": {:hex, :combine, "0.9.2", "cd3c8721f378ebe032487d8a4fa2ced3181a456a3c21b16464da8c46904bb552", [:mix], []},
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], []},
"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:make, :rebar], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]},
"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]},
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []},
"db_connection": {:hex, :db_connection, "1.0.0", "63c03e520d54886a66104d34e32397ba960db6e74b596ce221592c07d6a40d8d", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, optional: true]}]},
"decimal": {:hex, :decimal, "1.2.0", "462960fd71af282e570f7b477f6be56bf8968e68277d4d0b641a635269bf4b0d", [:mix], []},
"ecto": {:hex, :ecto, "2.0.5", "7f4c79ac41ffba1a4c032b69d7045489f0069c256de606523c65d9f8188e502d", [:mix], [{:db_connection, "~> 1.0-rc.4", [hex: :db_connection, optional: true]}, {:decimal, "~> 1.1.2 or ~> 1.2", [hex: :decimal, optional: false]}, {:mariaex, "~> 0.7.7", [hex: :mariaex, optional: true]}, {:poison, "~> 1.5 or ~> 2.0", [hex: :poison, optional: true]}, {:poolboy, "~> 1.5", [hex: :poolboy, optional: false]}, {:postgrex, "~> 0.12.0", [hex: :postgrex, optional: true]}, {:sbroker, "~> 1.0-beta", [hex: :sbroker, optional: true]}]},
"filtrex": {:hex, :filtrex, "0.3.0", "72023423f44e7b833e761ffa2079de761421f7c91fe9ad139f1b16de2e05a211", [:mix], [{:ecto, ">= 1.1.0", [hex: :ecto, optional: false]}, {:timex, "~> 2.1.4", [hex: :timex, optional: false]}]},
"fs": {:hex, :fs, "0.9.2", "ed17036c26c3f70ac49781ed9220a50c36775c6ca2cf8182d123b6566e49ec59", [:rebar], []},
"gettext": {:hex, :gettext, "0.12.1", "c0624f52763469ef7a3674919ae28b8286d88195b90fa1516180f31bbbd26d14", [:mix], []},
"hackney": {:hex, :hackney, "1.6.3", "d489d7ca2d4323e307bedc4bfe684323a7bf773ecfd77938f3ee8074e488e140", [:mix, :rebar3], [{:certifi, "0.7.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]},
"hackney": {:hex, :hackney, "1.6.3", "d489d7ca2d4323e307bedc4bfe684323a7bf773ecfd77938f3ee8074e488e140", [:rebar3, :mix], [{:certifi, "0.7.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, optional: false]}]},
"idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
"mime": {:hex, :mime, "1.0.1", "05c393850524767d13a53627df71beeebb016205eb43bfbd92d14d24ec7a1b51", [:mix], []},
Expand All @@ -28,6 +28,6 @@
"scrivener": {:hex, :scrivener, "2.1.1", "eb52c8b7d283e8999edd6fd50d872ab870669d1f4504134841d0845af11b5ef3", [:mix], []},
"scrivener_ecto": {:hex, :scrivener_ecto, "1.0.2", "4b10a2e6c23ed8aae59731d7ae71bfd55afea6559aae61b124e6e521055b4a9c", [:mix], [{:ecto, "~> 2.0", [hex: :ecto, optional: false]}, {:postgrex, "~> 0.11.0 or ~> 0.12.0", [hex: :postgrex, optional: true]}, {:scrivener, "~> 2.0", [hex: :scrivener, optional: false]}]},
"slime": {:hex, :slime, "0.13.0", "fb9b1296b5ef3fe6aed09deec2794a146c94f5270b3bcd9f956c01d3660fc196", [:mix], []},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], []},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:rebar, :make], []},
"timex": {:hex, :timex, "2.1.6", "2c59cd03074bccea47acd668c4dd6aad269879bcc9d6d4dd98fe0ffbaf48fcaa", [:mix], [{:combine, "~> 0.7", [hex: :combine, optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, optional: false]}]},
"tzdata": {:hex, :tzdata, "0.5.9", "575be217b039057a47e133b72838cbe104fb5329b19906ea4e66857001c37edb", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, optional: false]}]}}
2 changes: 1 addition & 1 deletion apps/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"phoenix": "file:../../deps/phoenix",
"phoenix_html": "file:../../deps/phoenix_html",
"torch": "file:../../apps/torch"
"torch": "file:../../"
},
"devDependencies": {
"babel-brunch": "~6.0.0",
Expand Down
31 changes: 5 additions & 26 deletions apps/example/web/controllers/admin/post_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ defmodule Example.Admin.PostController do

plug :put_layout, {Example.LayoutView, "admin.html"}
plug :scrub_params, "post" when action in [:create, :update]
plug :assign_categories

plug :assign_authors

@filtrex [
%Config{type: :boolean, keys: ~w(draft)},
%Config{type: :date, keys: ~w(inserted_at updated_at), options: %{format: "{YYYY}-{0M}-{0D}"}},
%Config{type: :text, keys: ~w(title body)},
%Config{type: :number, keys: ~w(author_id)},
%Config{type: :number, keys: ~w(category_id)}
%Config{type: :date, keys: ~w(inserted_at), options: %{format: "{YYYY}-{0M}-{0D}"}},
%Config{type: :text, keys: ~w(title body)}
]

@pagination [page_size: 10]
@pagination_distance 5

def index(conn, params) do
{:ok, filter} = Filtrex.parse_params(@filtrex, params["post"] || %{})
Expand All @@ -37,7 +31,8 @@ defmodule Example.Admin.PostController do
page_number: page.page_number,
page_size: page.page_size,
total_pages: page.total_pages,
total_entries: page.total_entries
total_entries: page.total_entries,
distance: @pagination_distance
end

def new(conn, _params) do
Expand Down Expand Up @@ -90,20 +85,4 @@ defmodule Example.Admin.PostController do
|> put_flash(:info, "Post deleted successfully.")
|> redirect(to: admin_post_path(conn, :index))
end

defp assign_categories(conn, _opts) do
categories =
Example.Category
|> Repo.all
|> Enum.map(&({&1.name, &1.id}))
assign(conn, :categories, categories)
end

defp assign_authors(conn, _opts) do
authors =
Example.Author
|> Repo.all
|> Enum.map(&({&1.name, &1.id}))
assign(conn, :authors, authors)
end
end
4 changes: 2 additions & 2 deletions apps/example/web/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
//
// If you no longer want to use a dependency, remember
// to also remove its path from "config.paths.watched".
import "phoenix_html"
import "torch"
import 'phoenix_html'
import 'torch'

// Import local files
//
Expand Down
20 changes: 0 additions & 20 deletions apps/example/web/templates/admin/post/_filters.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@
<h3>Search by Filters</h3>
<%= form_tag @conn.request_path, method: :get, id: "filters" do %>

<div class="field">
<label>Category</label>
<%= filter_assoc_select(:post, :category_id, @categories, @conn.params) %>
</div>

<div class="field">
<label>Author</label>
<%= filter_assoc_select(:post, :author_id, @authors, @conn.params) %>
</div>

<div class="field">
<label>Title</label>
<%= filter_select(:post, :title, @conn.params) %>
Expand All @@ -24,21 +14,11 @@
<%= filter_text_input(:post, :body, @conn.params) %>
</div>

<div class="field">
<label>Draft</label>
<%= filter_boolean_input(:post, :draft, @conn.params) %>
</div>

<div class="field">
<label>Inserted at</label>
<%= filter_date_input(:post, :inserted_at, @conn.params) %>
</div>

<div class="field">
<label>Updated at</label>
<%= filter_date_input(:post, :updated_at, @conn.params) %>
</div>

<button type="submit" class="torch-button">Search</button>
<% end %>

Expand Down
18 changes: 0 additions & 18 deletions apps/example/web/templates/admin/post/_form.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,6 @@
<%= error_tag f, :body %>
</div>

<div class="field">
<%= label f, :draft %>
<%= select f, :draft, [{"True", true}, {"False", false}] %>
<%= error_tag f, :draft %>
</div>

<div class="field">
<%= label f, :category %>
<%= select f, :category_id, @categories, prompt: "Choose one" %>
<%= error_tag f, :category_id %>
</div>

<div class="field">
<%= label f, :author %>
<%= select f, :author_id, @authors, prompt: "Choose one" %>
<%= error_tag f, :author_id %>
</div>

<div class="field">
<%= submit "Submit", class: "torch-button" %>
</div>
Expand Down
6 changes: 0 additions & 6 deletions apps/example/web/templates/admin/post/index.html.eex
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<tr>
<th><%= table_link(@conn, "Title", :title) %></th>
<th><%= table_link(@conn, "Body", :body) %></th>
<th><%= table_link(@conn, "Draft", :draft) %></th>
<th><%= table_link(@conn, "Category", :category_id) %></th>
<th><%= table_link(@conn, "Author", :author_id) %></th>

<th><span>Actions<span></th>
</tr>
Expand All @@ -25,9 +22,6 @@
<tr>
<td><%= post.title %></td>
<td><%= post.body %></td>
<td><%= post.draft %></td>
<td><%= table_assoc_display_name(post, :category_id, @categories) %>
<td><%= table_assoc_display_name(post, :author_id, @authors) %>

<td class="torch-actions">
<%= link "Edit", to: admin_post_path(@conn, :edit, post) %>
Expand Down
Loading

0 comments on commit 872cb3b

Please sign in to comment.