Switch to Bootstrap

This commit is contained in:
Shadowfacts 2019-04-01 12:24:22 -04:00
parent a59412efda
commit 65371bbfbb
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
16 changed files with 275 additions and 189 deletions

View File

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

View File

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

View File

@ -1,32 +1,36 @@
<h1>User Settings</h1> <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> <table class="table table-striped">
<tr> <thead>
<th>Client</th>
<th>Revoke Access</th>
</tr>
<%= for {approved, fervor} <- @clients do %>
<tr> <tr>
<td> <th>Client</th>
<%= if fervor.website do %> <th>Revoke Access</th>
<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>
</tr> </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> </table>

View File

@ -1,37 +1,42 @@
<%= form_tag Routes.feed_path(@conn, :refresh, @feed.id), method: :post do %> <h2><%= @feed.title %></h2>
<%= submit "Refresh Feed" %>
<% end %>
<%= 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 %> <%= if @feed.filter_enabled do %>
<%= form_tag Routes.feed_path(@conn, :disable_filter, @feed.id), method: :post do %> <%= form_tag Routes.feed_path(@conn, :disable_filter, @feed.id), method: :post, class: "d-inline" do %>
<%= submit "Disable Filter" %> <%= submit "Disable Filter", class: "btn btn-secondary" %>
<% end %> <% end %>
<%= form_tag Routes.filter_path(@conn, :edit, @feed.filter.id), method: :get do %> <%= form_tag Routes.filter_path(@conn, :edit, @feed.filter.id), method: :get, class: "d-inline" do %>
<%= submit "Edit Filter" %> <%= submit "Edit Filter", class: "btn btn-secondary" %>
<% end %> <% end %>
<% else %> <% else %>
<%= form_tag Routes.feed_path(@conn, :enable_filter, @feed.id), method: :post do %> <%= form_tag Routes.feed_path(@conn, :enable_filter, @feed.id), method: :post, class: "d-inline" do %>
<%= submit "Enable Filter" %> <%= submit "Enable Filter", class: "btn btn-secondary" %>
<% end %> <% end %>
<% end %> <% end %>
<%= form_tag Routes.feed_path(@conn, :delete, @feed.id), method: :delete do %> <%= form_tag Routes.feed_path(@conn, :delete, @feed.id), method: :delete, class: "d-inline" do %>
<%= submit "Delete Feed" %> <%= submit "Delete Feed", class: "btn btn-danger" %>
<% end %> <% end %>
<table> <h3 class="mt-4">Items</h3>
<%= for item <- @items do %>
<tr <%= if item.read do %>class="item-read"<% end %>> <table class="table table-striped">
<td> <tbody>
<a href="<%= Routes.item_path(@conn, :show, item.id) %>"><%= item.title %></a> <%= for item <- @items do %>
</td> <tr <%= if item.read do %>class="item-read"<% end %>>
<td> <td>
<% {:ok, date} = Timex.format(item.date, "{YYYY}-{M}-{D} {h12}:{m} {AM}") %> <a href="<%= Routes.item_path(@conn, :show, item.id) %>"><%= item.title %></a>
<%= date %> </td>
</td> <td>
</tr> <% {:ok, date} = Timex.format(item.date, "{YYYY}-{M}-{D} {h12}:{m} {AM}") %>
<% end %> <%= date %>
</td>
</tr>
<% end %>
</tbody>
</table> </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 %> <%= form_tag Routes.oauth_path(@conn, :authorize_post), method: :post do %>
<input type="hidden" name="client_id" value="<%= @client.client_id %>"> <input type="hidden" name="client_id" value="<%= @client.client_id %>">
@ -6,6 +6,7 @@
<input type="hidden" name="state" value="<%= @state %>"> <input type="hidden" name="state" value="<%= @state %>">
<% end %> <% end %>
<div class="form-group"> <div class="form-group">
<%= submit "Grant access" %> <%= submit "Grant access", class: "btn btn-primary" %>
<p>To reject the request, close this page.</p>
</div> </div>
<% end %> <% end %>

View File

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

View File

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

View File

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

View File

@ -3,29 +3,47 @@
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<title>Frenzy · Phoenix Framework</title>
<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") %>"/> <link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
</head> </head>
<body> <body>
<header> <header>
<section class="container"> <nav rol="navigation" class="navbar navbar-expand-lg navbar-light bg-light">
<nav role="navigation"> <div class="container">
<ul> <a href="/" class="navbar-brand">Frenzy</a>
<li><a href="/">Frenzy</a></li>
<%= unless is_nil(@conn.assigns[:user]) do %> <div class="" id="navbarContent">
<li><a href="<%= Routes.account_path(@conn, :show) %>">Account</a></li> <ul class="navbar-nav mr-auto">
<li><a href="<%= Routes.login_path(@conn, :logout) %>">Log Out</a></li> </ul>
<% end %> <ul class="navbar-nav flex-row ml-md-auto">
</ul> <%= unless is_nil(@conn.assigns[:user]) do %>
</nav> <li class="nav-item"><a href="<%= Routes.account_path(@conn, :show) %>" class="nav-link">Account</a></li>
</section> <li class="nav-item"><a href="<%= Routes.login_path(@conn, :logout) %>" class="nav-link">Log Out</a></li>
<% end %>
</ul>
</div>
</div>
</nav>
</header> </header>
<main role="main" class="container"> <main role="main" class="main mt-4">
<p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p> <div class="container">
<p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p> <%= if get_flash(@conn, :info) do %>
<%= render @view_module, @view_template, assigns %> <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> </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> <script type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</body> </body>
</html> </html>

View File

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

View File

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