some layout changes
This commit is contained in:
parent
326fb46236
commit
0cbaecd5dd
12
admin.rb
12
admin.rb
|
@ -3,13 +3,14 @@ class Admin < Sinatra::Base
|
||||||
use Rack::Session::Pool, :expire_after => 1800
|
use Rack::Session::Pool, :expire_after => 1800
|
||||||
use Rack::Flash, :accessorize => [:error, :warning, :notice]
|
use Rack::Flash, :accessorize => [:error, :warning, :notice]
|
||||||
set :haml, :layout => :admin_layout
|
set :haml, :layout => :admin_layout
|
||||||
|
register Sinatra::CompassSupport
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
haml :admin_index
|
haml :admin_index
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/post' do
|
get '/post' do
|
||||||
@posts = Post.all(:order => [:id.desc])
|
@posts = Post.all(:order => [:id.desc], :limit => 15)
|
||||||
haml :admin_posts
|
haml :admin_posts
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -112,6 +113,15 @@ class Admin < Sinatra::Base
|
||||||
end
|
end
|
||||||
hash = new_hash
|
hash = new_hash
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def markup content, markup
|
||||||
|
markup = markup.to_sym
|
||||||
|
if respond_to? markup
|
||||||
|
send markup, content
|
||||||
|
else
|
||||||
|
content
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%h1="Login"
|
%form#login.fields{:action => '/admin/login', :method => 'post'}
|
||||||
%form{:action => '/admin/login', :method => 'post'}
|
.login="Welcome in the admin area."
|
||||||
.username
|
.username
|
||||||
%label.block{:for => 'username'}='Username'
|
%label.block{:for => 'username'}='Username'
|
||||||
%input.block{:name => 'username', :placeholder => 'username', :value => flash[:username]}
|
%input.block{:name => 'username', :placeholder => 'username', :value => flash[:username]}
|
||||||
|
|
|
@ -2,11 +2,18 @@
|
||||||
%html
|
%html
|
||||||
%head
|
%head
|
||||||
%title="zero-knowledge - Adminpanel"
|
%title="zero-knowledge - Adminpanel"
|
||||||
%link{:rel => 'stylesheet', :href => '/stylesheet.css', :type => 'text/css'}
|
|
||||||
%link{:rel => 'stylesheet', :href => '/admin/stylesheet.css', :type => 'text/css'}
|
%link{:rel => 'stylesheet', :href => '/admin/stylesheet.css', :type => 'text/css'}
|
||||||
%script{:src => '/public/head.min.js'}
|
%script{:src => '/public/head.min.js'}
|
||||||
%body
|
%body
|
||||||
#menu="Menue"
|
#menu
|
||||||
|
%ul
|
||||||
|
%li
|
||||||
|
%a{:href => '/'}="main"
|
||||||
|
%li
|
||||||
|
%a{:href => '/admin'}="admin"
|
||||||
|
-if @account
|
||||||
|
%li
|
||||||
|
%a{:href => '/admin/new'}="create"
|
||||||
#messages
|
#messages
|
||||||
-unless flash.error.nil?
|
-unless flash.error.nil?
|
||||||
%p.error=flash.error
|
%p.error=flash.error
|
||||||
|
|
|
@ -8,3 +8,5 @@
|
||||||
%button{:type => :submit}="Update"
|
%button{:type => :submit}="Update"
|
||||||
%button{:type => :submit, :formmethod => :get,
|
%button{:type => :submit, :formmethod => :get,
|
||||||
:formaction => '/admin/post'}="Back"
|
:formaction => '/admin/post'}="Back"
|
||||||
|
|
||||||
|
~haml :post_single, :layout => nil
|
|
@ -1,17 +1,14 @@
|
||||||
|
.main
|
||||||
|
.content
|
||||||
|
%label{:for => :post_content}="Content"
|
||||||
|
%textarea.content{:id => :post_content,
|
||||||
|
:name => 'post[content]'}=@post.content
|
||||||
.title
|
.title
|
||||||
%label{:for => :post_title}="Title"
|
%label{:for => :post_title}="Title"
|
||||||
%input{:id => :post_title,
|
%input{:id => :post_title,
|
||||||
:name => 'post[title]',
|
:name => 'post[title]',
|
||||||
:value => @post.title}
|
:value => @post.title}
|
||||||
.author
|
.further
|
||||||
%label{:for => :post_author}="Author"
|
|
||||||
%select{:name => 'post[account_id]', :id => :post_author}
|
|
||||||
-Account.all(:order => [:id]).each do |account|
|
|
||||||
-if @post.account == account
|
|
||||||
%option{:value => account.id, :selected => :selected}
|
|
||||||
=account.username
|
|
||||||
-else
|
|
||||||
%option{:value => account.id}=account.username
|
|
||||||
.written
|
.written
|
||||||
%label{:for => :post_written}="written"
|
%label{:for => :post_written}="written"
|
||||||
%input{:id => :post_written,
|
%input{:id => :post_written,
|
||||||
|
@ -21,4 +18,17 @@
|
||||||
%input{:type => :checkbox, :name => 'post[released]',
|
%input{:type => :checkbox, :name => 'post[released]',
|
||||||
:class => "post-released-#{@post.released}", :value => 0,
|
:class => "post-released-#{@post.released}", :value => 0,
|
||||||
:checked => @post.released, :id => :post_released}
|
:checked => @post.released, :id => :post_released}
|
||||||
%textarea.content{:name => 'post[content]'}=@post.content
|
.author
|
||||||
|
%label{:for => :post_author}="Author"
|
||||||
|
%select{:name => 'post[account_id]', :id => :post_author}
|
||||||
|
-Account.all(:order => [:id]).each do |account|
|
||||||
|
-if @post.account == account
|
||||||
|
%option{:value => account.id, :selected => :selected}
|
||||||
|
=account.username
|
||||||
|
-else
|
||||||
|
%option{:value => account.id}=account.username
|
||||||
|
.tags
|
||||||
|
%label{:for => :post_tags}="Tags"
|
||||||
|
%select{:name => 'post[tags]', :id => :post_tags, :size => 10, :multiple => true}
|
||||||
|
- Tag.all.each do |tag|
|
||||||
|
%option{:value => tag.id}=tag.name
|
|
@ -4,4 +4,3 @@
|
||||||
%a{:href => "/admin/post/#{post.id}"}=post.title
|
%a{:href => "/admin/post/#{post.id}"}=post.title
|
||||||
%span.released{:class => "post-released-#{post.released}"}
|
%span.released{:class => "post-released-#{post.released}"}
|
||||||
.written=post.written
|
.written=post.written
|
||||||
.content=post.content
|
|
||||||
|
|
|
@ -1,17 +1,151 @@
|
||||||
|
// imports
|
||||||
|
@import "blueprint/colors";
|
||||||
|
@import "compass/reset";
|
||||||
|
@import "compass/css3";
|
||||||
|
@import "compass/utilities";
|
||||||
|
|
||||||
|
// variables
|
||||||
|
$font-color: hsl(0, 6%, 90%);
|
||||||
|
$link-color: $font-color;
|
||||||
|
$link-hover-color: hsl(32, 100%, 50%);
|
||||||
|
$border-color: black;
|
||||||
|
$background-normal: hsl(204, 25%, 35%);
|
||||||
|
$background-menu-normal: hsl(0, 0%, 20%);
|
||||||
|
$background-menu: color-stops(lighten($background-menu-normal, 15%),
|
||||||
|
$background-menu-normal 25%, darken($background-menu-normal, 15%));
|
||||||
|
$background-button: color-stops(lighten($background-normal, 15%),
|
||||||
|
$background-normal 75%, darken($background-normal, 5%));
|
||||||
|
$background-button-hover: color-stops(lighten($background-normal, 5%),
|
||||||
|
$background-normal 75%, darken($background-normal, 15%));
|
||||||
|
// some defaults for functions
|
||||||
|
$default-text-shadow-color: hsl(0, 10%, 50%);
|
||||||
|
$default-text-shadow-h-offset: 2px;
|
||||||
|
$default-text-shadow-v-offset: 2px;
|
||||||
|
$default-text-shadow-blur: 2px;
|
||||||
|
$default-border-radius: 2px;
|
||||||
|
|
||||||
|
body {background: $background-normal; color: $font-color;}
|
||||||
|
#menu, #messages, #content {
|
||||||
|
padding-left: 3em;
|
||||||
|
padding-right: 3em;
|
||||||
|
}
|
||||||
|
#messsages, #content {
|
||||||
|
padding-top: 1em;
|
||||||
|
}
|
||||||
|
#menu {
|
||||||
|
@include background-image(linear-gradient($background-menu));
|
||||||
|
li {
|
||||||
|
float: left;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
:after {
|
||||||
|
content: '';
|
||||||
|
clear: both;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: $link-color;
|
||||||
|
padding: 1em;
|
||||||
|
display: block;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
@include single-text-shadow;
|
||||||
|
&:hover {
|
||||||
|
color: $link-hover-color;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
#messages {
|
#messages {
|
||||||
|
padding-top: 1em;
|
||||||
.message {
|
.message {
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
.error {
|
.error {
|
||||||
@extend .message;
|
@extend .message;
|
||||||
background-color: red;
|
background-color: $error-bg-color;
|
||||||
|
border-color: $error-border-color;
|
||||||
|
color: $error-color;
|
||||||
}
|
}
|
||||||
.warning {
|
.warning {
|
||||||
@extend .message;
|
@extend .message;
|
||||||
background-color: orange;
|
background-color: $notice-bg-color;
|
||||||
|
border-color: $notice-border-color;
|
||||||
|
color: $notice-color;
|
||||||
}
|
}
|
||||||
.notice {
|
.notice {
|
||||||
@extend .message;
|
@extend .message;
|
||||||
background-color: green;
|
background-color: $success-bg-color;
|
||||||
|
border-color: $success-border-color;
|
||||||
|
color: $success-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#content {
|
||||||
|
.buttons {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
.fields {
|
||||||
|
clear: both;
|
||||||
|
.main {
|
||||||
|
width: 74%;
|
||||||
|
float: left;
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 25em;
|
||||||
|
@include box-sizing(border-box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.further {
|
||||||
|
float: right;
|
||||||
|
width: 24%;
|
||||||
|
}
|
||||||
|
.further:after {
|
||||||
|
content: '';
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
label, input, select {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
font-size: 120%;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
input, select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
padding: 0.5em;
|
||||||
|
margin: 0.1em;
|
||||||
|
border: 1px solid $border-color;
|
||||||
|
color: $link-color;
|
||||||
|
font-weight: bold;
|
||||||
|
@include background-image(linear-gradient($background-button));
|
||||||
|
&:hover {
|
||||||
|
@include background-image(linear-gradient($background-button-hover));
|
||||||
|
}
|
||||||
|
&:active {
|
||||||
|
position: relative;
|
||||||
|
top: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: $link-color;
|
||||||
|
font: {
|
||||||
|
weight: bold;
|
||||||
|
decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#login {
|
||||||
|
text-align: center;
|
||||||
|
.login {
|
||||||
|
padding: 1em;
|
||||||
|
font-weight: bold;
|
||||||
|
font-family: Sans;
|
||||||
|
}
|
||||||
|
> div {
|
||||||
|
width: 18em;
|
||||||
|
margin: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user