mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Redo administrate stuff with 0.1.4
This commit is contained in:
parent
80e06753e4
commit
043dc4c0d9
@ -1,8 +1,10 @@
|
||||
.sign_out {
|
||||
.logout {
|
||||
position: absolute;
|
||||
bottom: 1.5em;
|
||||
}
|
||||
|
||||
.login {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 50em;
|
||||
}
|
||||
|
||||
@ -4,14 +4,16 @@
|
||||
#
|
||||
# If you want to add pagination or other controller-level concerns,
|
||||
# you're free to overwrite the RESTful controller actions.
|
||||
class Admin::ApplicationController < Administrate::ApplicationController
|
||||
include Monban::ControllerHelpers
|
||||
module Admin
|
||||
class ApplicationController < Administrate::ApplicationController
|
||||
include Monban::ControllerHelpers
|
||||
|
||||
before_filter :require_login
|
||||
before_filter :require_login
|
||||
|
||||
# Override this value to specify the number of elements to display at a time
|
||||
# on index pages. Defaults to 20.
|
||||
# def records_per_page
|
||||
# params[:per_page] || 20
|
||||
# end
|
||||
# Override this value to specify the number of elements to display at a time
|
||||
# on index pages. Defaults to 20.
|
||||
# def records_per_page
|
||||
# params[:per_page] || 20
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
class SessionsController < ApplicationController
|
||||
layout 'administrate/login'
|
||||
layout 'admin/login'
|
||||
|
||||
skip_before_action :require_login, only: [:new, :create]
|
||||
|
||||
|
||||
@ -8,15 +8,16 @@ class CategoryDashboard < Administrate::BaseDashboard
|
||||
# which determines how the attribute is displayed
|
||||
# on pages throughout the dashboard.
|
||||
ATTRIBUTE_TYPES = {
|
||||
photos: Field::HasMany,
|
||||
id: Field::Number,
|
||||
name: Field::String,
|
||||
slug: Field::String,
|
||||
description: Field::Text,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
base_colour: Field::ColourField,
|
||||
photo_id: Field::Number,
|
||||
base_colour: Field::String,
|
||||
sort: Field::Number,
|
||||
photos: Field::HasMany,
|
||||
slug: Field::String,
|
||||
}
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
@ -25,25 +26,43 @@ class CategoryDashboard < Administrate::BaseDashboard
|
||||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:base_colour,
|
||||
:name,
|
||||
:description,
|
||||
:base_colour,
|
||||
:photos,
|
||||
]
|
||||
|
||||
# SHOW_PAGE_ATTRIBUTES
|
||||
# an array of attributes that will be displayed on the model's show page.
|
||||
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
|
||||
SHOW_PAGE_ATTRIBUTES = [
|
||||
:id,
|
||||
:name,
|
||||
:slug,
|
||||
:base_colour,
|
||||
:description,
|
||||
:created_at,
|
||||
:updated_at,
|
||||
:photo_id,
|
||||
:sort,
|
||||
:photos,
|
||||
]
|
||||
|
||||
# FORM_ATTRIBUTES
|
||||
# an array of attributes that will be displayed
|
||||
# on the model's form (`new` and `edit`) pages.
|
||||
FORM_ATTRIBUTES = [
|
||||
:photos,
|
||||
:name,
|
||||
:slug,
|
||||
:description,
|
||||
:photo_id,
|
||||
:base_colour,
|
||||
:sort,
|
||||
:photos,
|
||||
:slug,
|
||||
]
|
||||
|
||||
# Overwrite this method to customize how categories are displayed
|
||||
# across all pages of the admin dashboard.
|
||||
#
|
||||
def display_resource(category)
|
||||
category.name
|
||||
end
|
||||
end
|
||||
|
||||
@ -8,10 +8,10 @@ class PageDashboard < Administrate::BaseDashboard
|
||||
# which determines how the attribute is displayed
|
||||
# on pages throughout the dashboard.
|
||||
ATTRIBUTE_TYPES = {
|
||||
title: Field::String,
|
||||
content: Field::MarkdownField,
|
||||
id: Field::Number,
|
||||
name: Field::String,
|
||||
title: Field::String,
|
||||
content: Field::Text,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
}
|
||||
@ -22,14 +22,20 @@ class PageDashboard < Administrate::BaseDashboard
|
||||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:name,
|
||||
:title,
|
||||
:content,
|
||||
:name,
|
||||
]
|
||||
|
||||
# SHOW_PAGE_ATTRIBUTES
|
||||
# an array of attributes that will be displayed on the model's show page.
|
||||
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
|
||||
SHOW_PAGE_ATTRIBUTES = [
|
||||
:id,
|
||||
:name,
|
||||
:title,
|
||||
:content,
|
||||
:created_at,
|
||||
:updated_at,
|
||||
]
|
||||
|
||||
# FORM_ATTRIBUTES
|
||||
# an array of attributes that will be displayed
|
||||
@ -39,4 +45,11 @@ class PageDashboard < Administrate::BaseDashboard
|
||||
:title,
|
||||
:content,
|
||||
]
|
||||
|
||||
# Overwrite this method to customize how pages are displayed
|
||||
# across all pages of the admin dashboard.
|
||||
#
|
||||
def display_resource(page)
|
||||
page.title
|
||||
end
|
||||
end
|
||||
|
||||
@ -8,19 +8,21 @@ class PhotoDashboard < Administrate::BaseDashboard
|
||||
# which determines how the attribute is displayed
|
||||
# on pages throughout the dashboard.
|
||||
ATTRIBUTE_TYPES = {
|
||||
title: Field::String,
|
||||
image: Field::Image,
|
||||
description: Field::Text,
|
||||
categories: Field::HasMany,
|
||||
id: Field::Number,
|
||||
flickr_url: Field::String,
|
||||
taken_at: Field::DateTime,
|
||||
created_at: Field::DateTime,
|
||||
updated_at: Field::DateTime,
|
||||
title: Field::String,
|
||||
description: Field::Text,
|
||||
sort: Field::Number,
|
||||
featured: Field::Boolean,
|
||||
enabled: Field::Boolean,
|
||||
id: Field::Number,
|
||||
sort: Field::Number,
|
||||
taken_at: Field::DateTime,
|
||||
views: Field::Number,
|
||||
categories: Field::HasMany,
|
||||
image_uid: Field::String,
|
||||
image_name: Field::String,
|
||||
image_cloudinary_id: Field::String,
|
||||
}
|
||||
|
||||
# COLLECTION_ATTRIBUTES
|
||||
@ -29,28 +31,54 @@ class PhotoDashboard < Administrate::BaseDashboard
|
||||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:image,
|
||||
:title,
|
||||
:taken_at,
|
||||
:views,
|
||||
:featured,
|
||||
:categories,
|
||||
]
|
||||
|
||||
# SHOW_PAGE_ATTRIBUTES
|
||||
# an array of attributes that will be displayed on the model's show page.
|
||||
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
|
||||
SHOW_PAGE_ATTRIBUTES = [
|
||||
:categories,
|
||||
:id,
|
||||
:flickr_url,
|
||||
:created_at,
|
||||
:updated_at,
|
||||
:title,
|
||||
:description,
|
||||
:sort,
|
||||
:featured,
|
||||
:enabled,
|
||||
:taken_at,
|
||||
:views,
|
||||
:image_uid,
|
||||
:image_name,
|
||||
:image_cloudinary_id,
|
||||
]
|
||||
|
||||
# FORM_ATTRIBUTES
|
||||
# an array of attributes that will be displayed
|
||||
# on the model's form (`new` and `edit`) pages.
|
||||
FORM_ATTRIBUTES = [
|
||||
:title,
|
||||
:image,
|
||||
:description,
|
||||
:categories,
|
||||
:flickr_url,
|
||||
:taken_at,
|
||||
:title,
|
||||
:description,
|
||||
:sort,
|
||||
:featured,
|
||||
:enabled,
|
||||
:categories,
|
||||
:taken_at,
|
||||
:views,
|
||||
:image_uid,
|
||||
:image_name,
|
||||
:image_cloudinary_id,
|
||||
]
|
||||
|
||||
# Overwrite this method to customize how photos are displayed
|
||||
# across all pages of the admin dashboard.
|
||||
#
|
||||
# def display_resource(photo)
|
||||
# "Photo ##{photo.id}"
|
||||
# end
|
||||
end
|
||||
|
||||
@ -21,15 +21,18 @@ class UserDashboard < Administrate::BaseDashboard
|
||||
# By default, it's limited to four items to reduce clutter on index pages.
|
||||
# Feel free to add, remove, or rearrange items.
|
||||
COLLECTION_ATTRIBUTES = [
|
||||
:id,
|
||||
:email,
|
||||
:password_digest,
|
||||
:created_at,
|
||||
]
|
||||
|
||||
# SHOW_PAGE_ATTRIBUTES
|
||||
# an array of attributes that will be displayed on the model's show page.
|
||||
SHOW_PAGE_ATTRIBUTES = ATTRIBUTE_TYPES.keys
|
||||
SHOW_PAGE_ATTRIBUTES = [
|
||||
:id,
|
||||
:email,
|
||||
:password_digest,
|
||||
:created_at,
|
||||
:updated_at,
|
||||
]
|
||||
|
||||
# FORM_ATTRIBUTES
|
||||
# an array of attributes that will be displayed
|
||||
@ -38,4 +41,11 @@ class UserDashboard < Administrate::BaseDashboard
|
||||
:email,
|
||||
:password_digest,
|
||||
]
|
||||
|
||||
# Overwrite this method to customize how users are displayed
|
||||
# across all pages of the admin dashboard.
|
||||
#
|
||||
# def display_resource(user)
|
||||
# "User ##{user.id}"
|
||||
# end
|
||||
end
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
require "administrate/fields/base"
|
||||
|
||||
class ColourField < Administrate::Field::Base
|
||||
end
|
||||
@ -1,21 +0,0 @@
|
||||
require "administrate/fields/base"
|
||||
|
||||
class MarkdownField < Administrate::Field::Base
|
||||
def rendered
|
||||
renderer.render(data).html_safe
|
||||
end
|
||||
|
||||
def truncate
|
||||
data.to_s[0...truncation_length]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def renderer
|
||||
Redcarpet::Markdown.new(Redcarpet::Render::HTML, extensions: {})
|
||||
end
|
||||
|
||||
def truncation_length
|
||||
options.fetch(:truncate, 50)
|
||||
end
|
||||
end
|
||||
20
app/views/admin/application/_flashes.html.erb
Normal file
20
app/views/admin/application/_flashes.html.erb
Normal file
@ -0,0 +1,20 @@
|
||||
<%#
|
||||
# Flash Partial
|
||||
|
||||
This partial renders flash messages on every page.
|
||||
|
||||
## Relevant Helpers:
|
||||
|
||||
- `flash`:
|
||||
Returns a hash,
|
||||
where the keys are the type of flash (alert, error, notice, etc)
|
||||
and the values are the message to be displayed.
|
||||
%>
|
||||
|
||||
<% if flash.any? %>
|
||||
<div class="flashes">
|
||||
<% flash.each do |key, value| -%>
|
||||
<div class="flash flash--<%= key %>"><%= value %></div>
|
||||
<% end -%>
|
||||
</div>
|
||||
<% end %>
|
||||
19
app/views/admin/application/_javascript.html.erb
Normal file
19
app/views/admin/application/_javascript.html.erb
Normal file
@ -0,0 +1,19 @@
|
||||
<%#
|
||||
# Javascript Partial
|
||||
|
||||
This partial imports the necessary javascript on each page.
|
||||
By default, it includes the application JS,
|
||||
but each page can define additional JS sources
|
||||
by providing a `content_for(:javascript)` block.
|
||||
%>
|
||||
|
||||
<%= javascript_include_tag "administrate/application" %>
|
||||
|
||||
<%= yield :javascript %>
|
||||
|
||||
<% if Rails.env.test? %>
|
||||
<%= javascript_tag do %>
|
||||
$.fx.off = true;
|
||||
$.ajaxSetup({ async: false });
|
||||
<% end %>
|
||||
<% end %>
|
||||
20
app/views/admin/application/_sidebar.html.erb
Normal file
20
app/views/admin/application/_sidebar.html.erb
Normal file
@ -0,0 +1,20 @@
|
||||
<%#
|
||||
# Sidebar
|
||||
|
||||
This partial is used to display the sidebar in Administrate.
|
||||
By default, the sidebar contains navigation links
|
||||
for all resources in the admin dashboard,
|
||||
as defined by the routes in the `admin/` namespace
|
||||
%>
|
||||
|
||||
<ul class="sidebar__list">
|
||||
<% Administrate::Namespace.new(namespace).resources.each do |resource| %>
|
||||
<li>
|
||||
<%= link_to(
|
||||
display_resource_name(resource),
|
||||
[namespace, resource],
|
||||
class: "sidebar__link sidebar__link--#{nav_link_state(resource)}"
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
@ -1,74 +0,0 @@
|
||||
<%#
|
||||
# Table
|
||||
|
||||
This partial is used on the `index` and `show` pages
|
||||
to display a collection of resources in an HTML table.
|
||||
|
||||
## Local variables:
|
||||
|
||||
- `table_presenter`:
|
||||
An instance of [Administrate::Page::Table][1].
|
||||
The table presenter uses `ResourceDashboard::TABLE_ATTRIBUTES` to determine
|
||||
the columns displayed in the table
|
||||
- `resources`:
|
||||
An ActiveModel::Relation collection of resources to be displayed in the table.
|
||||
By default, the number of resources is limited by pagination
|
||||
or by a hard limit to prevent excessive page load times
|
||||
|
||||
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Table
|
||||
%>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<% collection_presenter.attribute_types.each do |attr_name, attr_type| %>
|
||||
<th class="cell-label cell-label--<%= attr_type.html_class %>
|
||||
cell-label--<%= collection_presenter.ordered_html_class(attr_name) %>
|
||||
">
|
||||
<%= link_to(params.merge(
|
||||
collection_presenter.order_params_for(attr_name)
|
||||
)) do %>
|
||||
<%= attr_name.to_s.titleize %>
|
||||
|
||||
<% if collection_presenter.ordered_by?(attr_name) %>
|
||||
<span class="cell-label__sort-indicator cell-label__sort-indicator--<%= collection_presenter.ordered_html_class(attr_name) %>">
|
||||
<%= inline_svg("administrate/sort_arrow.svg") %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</th>
|
||||
<% end %>
|
||||
<th colspan="2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% resources.each do |resource| %>
|
||||
<tr class="table__row"
|
||||
role="link"
|
||||
tabindex="0"
|
||||
data-url="<%= polymorphic_path([Administrate::NAMESPACE, resource]) -%>"
|
||||
>
|
||||
<% collection_presenter.attributes_for(resource).each do |attribute| %>
|
||||
<td class="cell-data cell-data--<%= attribute.html_class %>">
|
||||
<%= render_field attribute %>
|
||||
</td>
|
||||
<% end %>
|
||||
|
||||
<td><%= link_to(
|
||||
t("administrate.actions.edit"),
|
||||
[:edit, Administrate::NAMESPACE, resource],
|
||||
class: "action-edit",
|
||||
) %></td>
|
||||
|
||||
<td><%= link_to(
|
||||
t("administrate.actions.destroy"),
|
||||
[Administrate::NAMESPACE, resource],
|
||||
class: "table__action--destroy",
|
||||
method: :delete,
|
||||
data: { confirm: t("administrate.actions.confirm") }
|
||||
) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -1,44 +0,0 @@
|
||||
<%#
|
||||
# Form Partial
|
||||
|
||||
This partial is rendered on a resource's `new` and `edit` pages,
|
||||
and renders all form fields for a resource's editable attributes.
|
||||
|
||||
## Local variables:
|
||||
|
||||
- `page`:
|
||||
An instance of [Administrate::Page::Form][1].
|
||||
Contains helper methods to display a form,
|
||||
and knows which attributes should be displayed in the resource's form.
|
||||
|
||||
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form
|
||||
%>
|
||||
|
||||
<%= form_for([Administrate::NAMESPACE, page.resource], class: "form") do |f| %>
|
||||
<% if page.resource.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2>
|
||||
<%= pluralize(page.resource.errors.count, "error") %>
|
||||
prohibited this <%= page.resource_name %> from being saved:
|
||||
</h2>
|
||||
|
||||
<ul>
|
||||
<% page.resource.errors.full_messages.each do |message| %>
|
||||
<li><%= message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="form-inputs">
|
||||
<% page.attributes.each do |attribute| -%>
|
||||
<div class="form-field form-field--<%= attribute.html_class %>">
|
||||
<%= render_field attribute, f: f %>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<%= f.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
@ -1,25 +0,0 @@
|
||||
<%#
|
||||
# Edit
|
||||
|
||||
This view is the template for the edit page.
|
||||
|
||||
It displays a header, and renders the `_form` partial to do the heavy lifting.
|
||||
|
||||
## Local variables:
|
||||
|
||||
- `page`:
|
||||
An instance of [Administrate::Page::Form][1].
|
||||
Contains helper methods to help display a form,
|
||||
and knows which attributes should be displayed in the resource's form.
|
||||
|
||||
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form
|
||||
%>
|
||||
|
||||
<% content_for(:title) { "Edit #{page.page_title}" } %>
|
||||
|
||||
<header class="header">
|
||||
<h1 class="header-heading"><%= content_for(:title) %></h1>
|
||||
<%= link_to "Show #{page.resource}", [Administrate::NAMESPACE, page.resource], class: "button" %>
|
||||
</header>
|
||||
|
||||
<%= render "form", page: page %>
|
||||
@ -1,55 +0,0 @@
|
||||
<%#
|
||||
# Index
|
||||
|
||||
This view is the template for the index page.
|
||||
It is responsible for rendering the search bar, header and pagination.
|
||||
It renders the `_table` partial to display details about the resources.
|
||||
|
||||
## Local variables:
|
||||
|
||||
- `page`:
|
||||
An instance of [Administrate::Page::Table][1].
|
||||
Contains helper methods to help display a table,
|
||||
and knows which attributes should be displayed in the resource's table.
|
||||
- `resources`:
|
||||
An instance of `ActiveRecord::Relation` containing the resources
|
||||
that match the user's search criteria.
|
||||
By default, these resources are passed to the table partial to be displayed.
|
||||
- `search_term`:
|
||||
A string containing the term the user has searched for, if any.
|
||||
|
||||
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Table
|
||||
%>
|
||||
|
||||
<% content_for(:title) { page.resource_name.pluralize.titleize } %>
|
||||
|
||||
<% content_for(:search) do %>
|
||||
<form class="search">
|
||||
<span class="search__icon">
|
||||
<%= inline_svg "administrate/search.svg" %>
|
||||
</span>
|
||||
<input
|
||||
type="text"
|
||||
name="search"
|
||||
class="search__input"
|
||||
placeholder="Search"
|
||||
value="<%= search_term %>"
|
||||
/>
|
||||
<span class="search__hint">
|
||||
Press enter to search
|
||||
</span>
|
||||
</form>
|
||||
<% end %>
|
||||
|
||||
<header class="header">
|
||||
<h1 class="header-heading"><%= content_for(:title) %></h1>
|
||||
<%= link_to(
|
||||
"New #{page.resource_name.titleize.downcase}",
|
||||
[:new, Administrate::NAMESPACE, page.resource_name],
|
||||
class: "button",
|
||||
) %>
|
||||
</header>
|
||||
|
||||
<%= render "collection", collection_presenter: page, resources: resources %>
|
||||
|
||||
<%= paginate resources %>
|
||||
@ -1,25 +0,0 @@
|
||||
<%#
|
||||
# New
|
||||
|
||||
This view is the template for the "new resource" page.
|
||||
It displays a header, and then renders the `_form` partial
|
||||
to do the heavy lifting.
|
||||
|
||||
## Local variables:
|
||||
|
||||
- `page`:
|
||||
An instance of [Administrate::Page::Form][1].
|
||||
Contains helper methods to help display a form,
|
||||
and knows which attributes should be displayed in the resource's form.
|
||||
|
||||
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Form
|
||||
%>
|
||||
|
||||
<% content_for(:title) { "New #{page.resource_name.titleize}" } %>
|
||||
|
||||
<header class="header">
|
||||
<h1 class="header-heading"><%= content_for(:title) %></h1>
|
||||
<%= link_to 'Back', :back, class: "button" %>
|
||||
</header>
|
||||
|
||||
<%= render 'form', page: page %>
|
||||
@ -1,37 +0,0 @@
|
||||
<%#
|
||||
# Show
|
||||
|
||||
This view is the template for the show page.
|
||||
It renders the attributes of a resource,
|
||||
as well as a link to its edit page.
|
||||
|
||||
## Local variables:
|
||||
|
||||
- `page`:
|
||||
An instance of [Administrate::Page::Show][1].
|
||||
Contains methods for accessing the resource to be displayed on the page,
|
||||
as well as helpers for describing how each attribute of the resource
|
||||
should be displayed.
|
||||
|
||||
[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Show
|
||||
%>
|
||||
|
||||
<% content_for(:title) { page.page_title } %>
|
||||
|
||||
<header class="header">
|
||||
<h1 class="header-heading"><%= content_for(:title) %></h1>
|
||||
<%= link_to(
|
||||
"Edit",
|
||||
[:edit, Administrate::NAMESPACE, page.resource],
|
||||
class: "button",
|
||||
) %>
|
||||
</header>
|
||||
|
||||
<dl>
|
||||
<% page.attributes.each do |attribute| %>
|
||||
<dt class="attribute-label"><%= attribute.name.titleize %></dt>
|
||||
|
||||
<dd class="attribute-data attribute-data--<%=attribute.html_class%>"
|
||||
><%= render_field attribute %></dd>
|
||||
<% end %>
|
||||
</dl>
|
||||
48
app/views/layouts/admin/application.html.erb
Normal file
48
app/views/layouts/admin/application.html.erb
Normal file
@ -0,0 +1,48 @@
|
||||
<%#
|
||||
# Application Layout
|
||||
|
||||
This view template is used as the layout
|
||||
for every page that Administrate generates.
|
||||
|
||||
By default, it renders:
|
||||
- Sidebar for navigation
|
||||
- Content for a search bar
|
||||
(if provided by a `content_for` block in a nested page)
|
||||
- Flashes
|
||||
- Links to stylesheets and Javascripts
|
||||
%>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= I18n.locale %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="ROBOTS" content="NOODP" />
|
||||
<meta name="viewport" content="initial-scale=1" />
|
||||
<title><%= content_for(:title) %> | <%= Rails.application.class.parent_name.titlecase %></title>
|
||||
<%= stylesheet_link_tag "administrate/application", media: "all" %>
|
||||
<%= stylesheet_link_tag "administrate/overrides", media: "all" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="app-container">
|
||||
|
||||
<div class="sidebar">
|
||||
<%= render "sidebar" -%>
|
||||
<%= content_tag :div, class: :logout do %>
|
||||
<%= link_to "Log out", session_path, method: :delete %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<main class="main-content" role="main">
|
||||
<%= content_for(:search) %>
|
||||
<%= render "flashes" -%>
|
||||
<%= yield %>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
<%= render "javascript" %>
|
||||
</body>
|
||||
</html>
|
||||
40
app/views/layouts/admin/login.html.erb
Normal file
40
app/views/layouts/admin/login.html.erb
Normal file
@ -0,0 +1,40 @@
|
||||
<%#
|
||||
# Application Layout
|
||||
|
||||
This view template is used as the layout
|
||||
for every page that Administrate generates.
|
||||
|
||||
By default, it renders:
|
||||
- Sidebar for navigation
|
||||
- Content for a search bar
|
||||
(if provided by a `content_for` block in a nested page)
|
||||
- Flashes
|
||||
- Links to stylesheets and Javascripts
|
||||
%>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= I18n.locale %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="ROBOTS" content="NOODP" />
|
||||
<meta name="viewport" content="initial-scale=1" />
|
||||
<title><%= Rails.application.class.parent_name.titlecase %></title>
|
||||
<%= stylesheet_link_tag "administrate/application", media: "all" %>
|
||||
<%= stylesheet_link_tag "administrate/overrides", media: "all" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="app-container">
|
||||
|
||||
<main class="main-content login" role="main">
|
||||
<%= render "admin/application/flashes" -%>
|
||||
<%= yield %>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
<%= render "admin/application/javascript" %>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,34 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="ROBOTS" content="NOODP" />
|
||||
<meta name="viewport" content="initial-scale=1" />
|
||||
<title><%= content_for(:title) %> | <%= Rails.application.class.parent_name.titlecase %></title>
|
||||
<%= stylesheet_link_tag "//fonts.googleapis.com/css?family=Lato:300,400,900", media: "all" %>
|
||||
<%= stylesheet_link_tag "administrate/application", media: "all" %>
|
||||
<%= stylesheet_link_tag "administrate/overrides", media: "all" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
|
||||
<body class="administrate">
|
||||
<main class="main">
|
||||
<div class="sidebar">
|
||||
<%= render "sidebar" -%>
|
||||
<%= content_tag :div, class: :sign_out do %>
|
||||
<%= link_to "Sign out", session_path, method: :delete %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<%= content_for(:search) %>
|
||||
<div class="content">
|
||||
<%= render "flashes" -%>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<%= render "javascript" %>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,24 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="ROBOTS" content="NOODP" />
|
||||
<meta name="viewport" content="initial-scale=1" />
|
||||
<title><%= Rails.application.class.parent_name.titlecase %></title>
|
||||
<%= stylesheet_link_tag "//fonts.googleapis.com/css?family=Lato:300,400,900", media: "all" %>
|
||||
<%= stylesheet_link_tag "administrate/application", media: "all" %>
|
||||
<%= stylesheet_link_tag "administrate/overrides", media: "all" %>
|
||||
<%= csrf_meta_tags %>
|
||||
</head>
|
||||
|
||||
<body class="administrate">
|
||||
<main class="main login">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<%= render "administrate/application/flashes" -%>
|
||||
<%= yield %>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
@ -4,14 +4,22 @@
|
||||
|
||||
<%= form_for :session, url: session_path do |form| %>
|
||||
<div class="form-inputs">
|
||||
<div class="form-field form-field--string">
|
||||
<%= form.label :email %>
|
||||
<%= form.email_field :email %>
|
||||
<div class="field-unit field-unit--string">
|
||||
<div class="field-unit__label">
|
||||
<%= form.label :email %>
|
||||
</div>
|
||||
<div class="field-unit__field">
|
||||
<%= form.email_field :email %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field form-field--string">
|
||||
<%= form.label :password %>
|
||||
<%= form.password_field :password %>
|
||||
<div class="field-unit field-unit--string">
|
||||
<div class="field-unit__label">
|
||||
<%= form.label :password %>
|
||||
</div>
|
||||
<div class="field-unit__field">
|
||||
<%= form.password_field :password %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ DanBarberPhoto::Application.configure do
|
||||
:domain => 'heroku.com'
|
||||
}
|
||||
ActionMailer::Base.delivery_method = :smtp
|
||||
|
||||
|
||||
config.action_mailer.default_url_options = { :host => "danbarberphoto.com" }
|
||||
|
||||
end
|
||||
|
||||
@ -3,11 +3,12 @@ require 'monban/constraints/signed_out'
|
||||
|
||||
DanBarberPhoto::Application.routes.draw do
|
||||
namespace :admin do
|
||||
DashboardManifest::DASHBOARDS.each do |dashboard_resource|
|
||||
resources dashboard_resource
|
||||
end
|
||||
resources :categories
|
||||
resources :pages
|
||||
resources :photos
|
||||
resources :users
|
||||
|
||||
root controller: DashboardManifest::ROOT_DASHBOARD, action: :index
|
||||
root to: "categories#index"
|
||||
end
|
||||
|
||||
resource :session, only: [:new, :create, :destroy]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user