Compare commits

...

2 Commits

Author SHA1 Message Date
Shadowfacts 65371bbfbb
Switch to Bootstrap 2019-04-01 12:24:22 -04:00
Shadowfacts a59412efda
Don't ignore priv/static 2019-04-01 11:36:52 -04:00
23 changed files with 423 additions and 192 deletions

5
.gitignore vendored
View File

@ -22,11 +22,6 @@ erl_crash.dump
# Ignore package tarball (built via "mix hex.build").
frenzy-*.tar
# Since we are building assets from assets/,
# we ignore priv/static. You may want to comment
# this depending on your deployment strategy.
/priv/static/
# Files matching config/*.secret.exs pattern contain sensitive
# data and you should not commit them into version control.
#

View File

@ -1,11 +1,15 @@
<h2>Change Fever Password</h2>
<%= form_tag Routes.account_path(@conn, :do_change_fever_password), method: :post do %>
<div class="form-group">
<label for="new_password">New Fever Password</label>
<input type="password" name="new_password" id="new_password" minlength="8">
<div class="form-group row">
<label for="new_password" class="col-sm-2 col-form-label">New Fever Password</label>
<div class="col-sm-10">
<input type="password" name="new_password" id="new_password" minlength="8" class="form-control">
</div>
</div>
<div class="form-group">
<%= submit "Change Fever Password" %>
<div class="form-group row">
<div class="col-sm-10">
<%= submit "Change Fever Password", class: "btn btn-primary" %>
</div>
</div>
<% end %>

View File

@ -1,19 +1,27 @@
<h2>Change Password</h2>
<%= form_tag Routes.account_path(@conn, :do_change_password), method: :post do %>
<div class="form-group">
<label for="old_password">Old Password</label>
<input type="password" name="old_password" id="old_password" minlength="8">
<div class="form-group row">
<label for="old_password" class="col-sm-2 col-form-label">Old Password</label>
<div class="col-sm-10">
<input type="password" name="old_password" id="old_password" minlength="8" class="form-control">
</div>
</div>
<div class="form-group">
<label for="new_password">New Password</label>
<input type="password" name="new_password" id="new_password" minlength="8">
<div class="form-group row">
<label for="new_password" class="col-sm-2 col-form-label">New Password</label>
<div class="col-sm-10">
<input type="password" name="new_password" id="new_password" minlength="8" class="form-control">
</div>
</div>
<div class="form-group">
<label for="confirm_new_password">Confirm New Password</label>
<input type="password" name="confirm_new_password" id="confirm_new_password" minlength="8">
<div class="form-group row">
<label for="confirm_new_password" class="col-sm-2 col-form-label">Confirm New Password</label>
<div class="col-sm-10">
<input type="password" name="confirm_new_password" id="confirm_new_password" minlength="8" class="form-control">
</div>
</div>
<div class="form-group">
<%= submit "Change Password" %>
<div class="form-group row">
<div class="col-sm-10">
<%= submit "Change Password", class: "btn btn-primary" %>
</div>
</div>
<% end %>

View File

@ -1,32 +1,36 @@
<h1>User Settings</h1>
<h2><%= @user.username %></h2>
<h2><pre><%= @user.username %></pre></h2>
<a href="<%= Routes.account_path(@conn, :change_password) %>" class="button">Change Password</a>
<a href="<%= Routes.account_path(@conn, :change_password) %>" class="btn btn-secondary">Change Password</a>
<a href="<%= Routes.account_path(@conn, :change_fever_password) %>" class="button">Change Fever Password</a>
<a href="<%= Routes.account_path(@conn, :change_fever_password) %>" class="btn btn-secondary">Change Fever Password</a>
<h2>Approved Clients</h2>
<h2 class="mt-4">Approved Clients</h2>
<table>
<tr>
<th>Client</th>
<th>Revoke Access</th>
</tr>
<%= for {approved, fervor} <- @clients do %>
<table class="table table-striped">
<thead>
<tr>
<td>
<%= if fervor.website do %>
<a href="<%= fervor.website %>"><%= fervor.client_name %></a>
<% else %>
<%= fervor.client_name %>
<% end %>
</td>
<td>
<%= form_tag Routes.account_path(@conn, :remove_client), method: :post do %>
<input type="hidden" name="client_id" value="<%= approved.client_id %>">
<%= submit "Revoke" %>
<% end %>
</td>
<th>Client</th>
<th>Revoke Access</th>
</tr>
<% end %>
</thead>
<tbody>
<%= for {approved, fervor} <- @clients do %>
<tr>
<td>
<%= if fervor.website do %>
<a href="<%= fervor.website %>"><%= fervor.client_name %></a>
<% else %>
<%= fervor.client_name %>
<% end %>
</td>
<td>
<%= form_tag Routes.account_path(@conn, :remove_client), method: :post do %>
<input type="hidden" name="client_id" value="<%= approved.client_id %>">
<%= submit "Revoke", class: "btn btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -1,37 +1,42 @@
<%= form_tag Routes.feed_path(@conn, :refresh, @feed.id), method: :post do %>
<%= submit "Refresh Feed" %>
<% end %>
<h2><%= @feed.title %></h2>
<%= form_tag Routes.feed_path(@conn, :refresh, @feed.id), method: :post, class: "d-inline" do %>
<%= submit "Refresh Feed", class: "btn btn-primary" %>
<% end %>
<%= if @feed.filter_enabled do %>
<%= form_tag Routes.feed_path(@conn, :disable_filter, @feed.id), method: :post do %>
<%= submit "Disable Filter" %>
<%= form_tag Routes.feed_path(@conn, :disable_filter, @feed.id), method: :post, class: "d-inline" do %>
<%= submit "Disable Filter", class: "btn btn-secondary" %>
<% end %>
<%= form_tag Routes.filter_path(@conn, :edit, @feed.filter.id), method: :get do %>
<%= submit "Edit Filter" %>
<%= form_tag Routes.filter_path(@conn, :edit, @feed.filter.id), method: :get, class: "d-inline" do %>
<%= submit "Edit Filter", class: "btn btn-secondary" %>
<% end %>
<% else %>
<%= form_tag Routes.feed_path(@conn, :enable_filter, @feed.id), method: :post do %>
<%= submit "Enable Filter" %>
<%= form_tag Routes.feed_path(@conn, :enable_filter, @feed.id), method: :post, class: "d-inline" do %>
<%= submit "Enable Filter", class: "btn btn-secondary" %>
<% end %>
<% end %>
<%= form_tag Routes.feed_path(@conn, :delete, @feed.id), method: :delete do %>
<%= submit "Delete Feed" %>
<%= form_tag Routes.feed_path(@conn, :delete, @feed.id), method: :delete, class: "d-inline" do %>
<%= submit "Delete Feed", class: "btn btn-danger" %>
<% end %>
<table>
<%= for item <- @items do %>
<tr <%= if item.read do %>class="item-read"<% end %>>
<td>
<a href="<%= Routes.item_path(@conn, :show, item.id) %>"><%= item.title %></a>
</td>
<td>
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{M}-{D} {h12}:{m} {AM}") %>
<%= date %>
</td>
</tr>
<% end %>
<h3 class="mt-4">Items</h3>
<table class="table table-striped">
<tbody>
<%= for item <- @items do %>
<tr <%= if item.read do %>class="item-read"<% end %>>
<td>
<a href="<%= Routes.item_path(@conn, :show, item.id) %>"><%= item.title %></a>
</td>
<td>
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{M}-{D} {h12}:{m} {AM}") %>
<%= date %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -1,4 +1,4 @@
<h1><%= @client.client_name %> wants to access your account</h1>
<h2><%= @client.client_name %> wants to access your account</h2>
<%= form_tag Routes.oauth_path(@conn, :authorize_post), method: :post do %>
<input type="hidden" name="client_id" value="<%= @client.client_id %>">
@ -6,6 +6,7 @@
<input type="hidden" name="state" value="<%= @state %>">
<% end %>
<div class="form-group">
<%= submit "Grant access" %>
<%= submit "Grant access", class: "btn btn-primary" %>
<p>To reject the request, close this page.</p>
</div>
<% end %>

View File

@ -1,53 +1,75 @@
<h2>Filter</h2>
<%= form_for @changeset, Routes.filter_path(@conn, :update, @changeset.data.id), fn form -> %>
<div class="form-group">
<label for="mode">Mode</label>
<%= select form, :mode, [{"Accept", :accept}, {"Reject", :reject}] %>
<div class="form-group row">
<label for="mode" class="col-sm-2 col-form-label">Mode</label>
<div class="col-sm-10">
<%= select form, :mode, [{"Accept", :accept}, {"Reject", :reject}], class: "form-control" %>
</div>
</div>
<div class="form-group">
<label for="score">Score</label>
<%= number_input form, :score %>
<div class="form-group row">
<label for="score" class="col-sm-2 col-form-label">Score</label>
<div class="col-sm-10">
<%= number_input form, :score, class: "form-control" %>
</div>
</div>
<table>
<tr>
<th>Property</th>
<th>Mode</th>
<th>Param</th>
<th>Weight</th>
</tr>
<%= inputs_for form, :rules, fn p -> %>
<tr>
<td>
<%= select p, :property, [{"URL", :url}, {"Title", :title}, {"Author", :author}, {"Content", :content}] %>
</td>
<td>
<%= select p, :mode, [{"contains", :contains_string}, {"matches regex", :matches_regex}] %>
</td>
<td>
<%= text_input p, :param %>
</td>
<td>
<%= number_input p, :weight %>
</td>
<td>
<%# when nesting form tags, the first nested one seems to get removed %>
<%# not the first nested one in each row, but the first nested one overall %>
<%# so we include a dummy form with display: none that gets stripped from the first row %>
<%# but is present and invisible in subsequent rows %>
<form style="display: none;"></form>
<%= form_tag Routes.filter_path(@conn, :remove_rule, @changeset.data.id, [rule_id: p.data.id]), method: :post do %>
<%= submit "Delete" %>
<div class="card mt-5 mb-5">
<div class="card-body">
<h3>Rules</h3>
<table class="table">
<thead>
<tr>
<th>Property</th>
<th>Mode</th>
<th>Param</th>
<th>Weight</th>
<th></th>
</tr>
</thead>
<tbody>
<%= inputs_for form, :rules, fn p -> %>
<tr>
<td>
<%= select p, :property, [{"URL", :url}, {"Title", :title}, {"Author", :author}, {"Content", :content}], class: "form-control" %>
</td>
<td>
<%= select p, :mode, [{"contains", :contains_string}, {"matches regex", :matches_regex}], class: "form-control" %>
</td>
<td>
<%= text_input p, :param, class: "form-control" %>
</td>
<td>
<%= number_input p, :weight, class: "form-control" %>
</td>
<td>
<%# when nesting form tags, the first nested one seems to get removed %>
<%# not the first nested one in each row, but the first nested one overall %>
<%# so we include a dummy form with display: none that gets stripped from the first row %>
<%# but is present and invisible in subsequent rows %>
<form style="display: none;"></form>
<%= form_tag Routes.filter_path(@conn, :remove_rule, @changeset.data.id, [rule_id: p.data.id]), method: :post do %>
<%= submit "Delete", class: "btn btn-danger" %>
<% end %>
</td>
</tr>
<% end %>
</td>
</tr>
<% end %>
</table>
</tbody>
</table>
<div class="form-group">
<%= submit "Update Filter" %>
<div class="form-group row">
<div class="col-sm-10">
<%= form_tag Routes.filter_path(@conn, :add_rule, @changeset.data.id), method: :post do %>
<%= submit "Add Rule", class: "btn btn-secondary" %>
<% end %>
</div>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-10">
<%= submit "Update Filter", class: "btn btn-primary" %>
</div>
</div>
<% end %>
<%= form_tag Routes.filter_path(@conn, :add_rule, @changeset.data.id), method: :post do %>
<%= submit "Add Rule" %>
<% end %>

View File

@ -1,17 +1,25 @@
<a href="<%= Routes.group_path(@conn, :new) %>" class="button">Add Group</a>
<a href="<%= Routes.group_path(@conn, :new) %>" class="btn btn-primary">Add Group</a>
<table>
<%= for group <- @groups do %>
<table class="table table-striped mt-4">
<thead>
<tr>
<td>
<a href="/groups/<%= group.id %>"><%= group.title %></a>
</td>
<td>
<%= case Enum.count(group.feeds) do
1 -> "1 feed"
count -> "#{count} feeds"
end %>
</td>
<th>Name</th>
<th></th>
</tr>
<% end %>
</thead>
<tbody>
<%= for group <- @groups do %>
<tr>
<td>
<a href="/groups/<%= group.id %>"><%= group.title %></a>
</td>
<td>
<%= case Enum.count(group.feeds) do
1 -> "1 feed"
count -> "#{count} feeds"
end %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -1,9 +1,13 @@
<%= form_for @changeset, Routes.group_path(@conn, :create), fn form -> %>
<div class="form-group">
<label for="title">Title</label>
<%= text_input form, :title %>
<div class="form-group row">
<label for="title" class="col-sm-2 col-form-label">Title</label>
<div class="col-sm-10">
<%= text_input form, :title, placeholder: "My New Group", class: "form-control" %>
</div>
</div>
<div class="form-group">
<%= submit "Create Group" %>
<div class="form-group row">
<div class="col-sm-10">
<%= submit "Create Group", class: "btn btn-primary" %>
</div>
</div>
<% end %>

View File

@ -1,29 +1,37 @@
<h2><%= @group.title %></h2>
<%= form_tag Routes.group_path(@conn, :delete, @group.id), method: :delete do %>
<%= submit "Delete Group" %>
<% end %>
<%= form_for @create_feed_changeset, Routes.feed_path(@conn, :create), fn form -> %>
<%= hidden_input form, :group_id %>
<div class="form-group">
<%= label form, :feed_url, "Feed URL" %>
<%= text_input form, :feed_url %>
<div class="form-group row">
<%= label form, :feed_url, "Feed URL", class: "col-sm-2 col-form-label" %>
<div class="col-sm-10">
<%= text_input form, :feed_url, placeholder: "https://example.com/feed.xml", class: "form-control" %>
</div>
</div>
<div class="form-group">
<%= submit "Add Feed" %>
<div class="form-group row">
<div class="col-sm-10">
<%= submit "Add Feed", class: "btn btn-primary" %>
</div>
</div>
<% end %>
<table>
<%= for feed <- @group.feeds do %>
<tr>
<td>
<a href="<%= Routes.feed_path(@conn, :show, feed.id) %>"><%= feed.feed_url %></a>
</td>
<td>
<a href="<%= feed.site_url %>"><%= feed.title %></a>
</td>
</tr>
<% end %>
<%= form_tag Routes.group_path(@conn, :delete, @group.id), method: :delete do %>
<%= submit "Delete Group", class: "btn btn-danger" %>
<% end %>
<h3 class="mt-4">Feeds</h3>
<table class="table table-striped">
<tbody>
<%= for feed <- @group.feeds do %>
<tr>
<td>
<a href="<%= Routes.feed_path(@conn, :show, feed.id) %>"><%= feed.feed_url %></a>
</td>
<td>
<a href="<%= feed.site_url %>"><%= feed.title %></a>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@ -1,17 +1,17 @@
<%= if @item.read do %>
<%= form_tag Routes.item_path(@conn, :unread, @item.id), method: :post do %>
<%= submit "Mark as Unread" %>
<% end %>
<% else %>
<%= form_tag Routes.item_path(@conn, :read, @item.id), method: :post do %>
<%= submit "Mark as Read" %>
<% end %>
<% end %>
<a href="<%= Routes.feed_path(@conn, :show, @feed.id) %>"><%= @feed.title %></a>
<h1>
<a href="<%= @item.url %>"><%= @item.title %></a>
</h1>
<article>
<%= if @item.read do %>
<%= form_tag Routes.item_path(@conn, :unread, @item.id), method: :post do %>
<%= submit "Mark as Unread", class: "btn btn-secondary" %>
<% end %>
<% else %>
<%= form_tag Routes.item_path(@conn, :read, @item.id), method: :post do %>
<%= submit "Mark as Read", class: "btn btn-secondary" %>
<% end %>
<% end %>
<article class="mt-4">
<%= raw(@item.content) %>
</article>

View File

@ -3,29 +3,47 @@
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Frenzy · Phoenix Framework</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<title>Frenzy</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
</head>
<body>
<header>
<section class="container">
<nav role="navigation">
<ul>
<li><a href="/">Frenzy</a></li>
<%= unless is_nil(@conn.assigns[:user]) do %>
<li><a href="<%= Routes.account_path(@conn, :show) %>">Account</a></li>
<li><a href="<%= Routes.login_path(@conn, :logout) %>">Log Out</a></li>
<% end %>
</ul>
</nav>
</section>
<nav rol="navigation" class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a href="/" class="navbar-brand">Frenzy</a>
<div class="" id="navbarContent">
<ul class="navbar-nav mr-auto">
</ul>
<ul class="navbar-nav flex-row ml-md-auto">
<%= unless is_nil(@conn.assigns[:user]) do %>
<li class="nav-item"><a href="<%= Routes.account_path(@conn, :show) %>" class="nav-link">Account</a></li>
<li class="nav-item"><a href="<%= Routes.login_path(@conn, :logout) %>" class="nav-link">Log Out</a></li>
<% end %>
</ul>
</div>
</div>
</nav>
</header>
<main role="main" class="container">
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<%= render @view_module, @view_template, assigns %>
<main role="main" class="main mt-4">
<div class="container">
<%= if get_flash(@conn, :info) do %>
<p class="alert alert-primary" role="alert"><%= get_flash(@conn, :info) %></p>
<% end %>
<%= if get_flash(@conn, :error) do %>
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
<% end %>
<%= render @view_module, @view_template, assigns %>
</div>
</main>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</body>
</html>

View File

@ -2,15 +2,21 @@
<%= if @continue do %>
<input type="hidden" name="continue" value="<%= @continue %>">
<% end %>
<div class="form-group">
<label for="username">Username</label>
<input type="text" name="username" id="username">
<div class="form-group row">
<label for="username" class="col-sm-2 col-form-label">Username</label>
<div class="col-sm-10">
<input type="text" name="username" id="username" class="form-control">
</div>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" name="password" id="password">
<div class="form-group row">
<label for="password" class="col-sm-2 col-form-label">Password</label>
<div class="col-sm-10">
<input type="password" name="password" id="password" class="form-control">
</div>
</div>
<div class="form-group">
<%= submit "Log In" %>
<div class="form-group row">
<div class="col-sm-10">
<%= submit "Log In", class: "btn btn-primary" %>
</div>
</div>
<% end %>

View File

@ -0,0 +1,3 @@
defmodule FrenzyWeb.Fervor.OauthView do
use FrenzyWeb, :view
end

View File

@ -1,3 +0,0 @@
defmodule FrenzyWeb.OauthView do
use FrenzyWeb, :view
end

5
priv/static/css/app.css Normal file
View File

@ -0,0 +1,5 @@
/* This file is for your main application css. */
.item-read a {
color: #606c76;
}

134
priv/static/css/phoenix.css Normal file

File diff suppressed because one or more lines are too long

BIN
priv/static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

3
priv/static/js/app.js Normal file
View File

@ -0,0 +1,3 @@
// for phoenix_html support, including form and button helpers
// copy the following scripts into your javascript bundle:
// * https://raw.githubusercontent.com/phoenixframework/phoenix_html/v2.10.0/priv/static/phoenix_html.js

File diff suppressed because one or more lines are too long

5
priv/static/robots.txt Normal file
View File

@ -0,0 +1,5 @@
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
User-agent: *
Disallow: /