Commit fb3d73fc authored by Milan's avatar Milan

setup basic blog functionallity

parent dbd3dd9f
@import 'perfect-scrollbar';
//@import 'color-variables';
//@import 'bootstrap-complete';
//@import 'mixins';
@import 'color-variables';
@import 'bootstrap-complete';
@import 'mixins';
// core
@import 'media-box';
@import 'entypo';
@import 'icons';
@import 'mentions';
@import 'animations';
@import 'flash_messages';
@import 'sprites';
@import 'hovercard';
@import 'base';
@import 'interactions';
@import 'spinner';
@import 'timeago';
@import 'vendor/fileuploader';
@import 'vendor/autoSuggest';
@import 'typeahead';
@import 'colors';
@import 'card-footer';
// font overrides
@import 'typography';
// layout
@import 'sidebar';
// home
@import 'home';
// login
@import 'login';
@import 'registration';
@import 'forms';
// terms
@import 'terms';
// profile and settings pages
@import 'settings';
// new SPV
@import 'header';
@import 'footer';
@import 'opengraph';
@import 'single-post-view';
@import 'poll';
// map
@import 'leaflet';
@import 'map';
// conversations
@import 'conversations';
// publisher
@import 'publisher';
@import 'aspects';
@import 'markdown-editor';
// bookmarklet
@import 'bookmarklet';
// notifications
@import 'notifications';
// help
@import 'help';
// getting started
@import 'getting-started';
// people
@import 'people';
@import 'invitations';
@import 'profile';
// stream
@import 'tag';
@import 'stream';
@import 'stream_element';
@import 'comments';
@import 'diaspora_jsxc';
@import 'chat';
@import 'markdown-content';
@import 'oembed';
@import 'post-content';
// contacts
@import 'contacts';
@import 'navbar_left';
// code
@import 'code';
@import 'highlightjs/github';
// statistics
@import 'statistics';
// gallery
@import 'blueimp-gallery';
@import 'blueimp-gallery/blueimp-gallery-indicator';
@import 'gallery';
// settings
@import 'user_applications';
// OpenID Connect (API)
@import 'openid_connect_error_page';
// Place all the styles related to the blog controller here.
// Place all the styles related to the blogposts controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
This diff is collapsed.
.navbar.navbar-fixed-top {
border-bottom: none;
box-shadow: 1px 0 2px black;
a:focus {outline: 0 none; }
.navbar-brand {
font-weight: bold;
font-size: $font-size-h3;
}
@media (max-width: $grid-float-breakpoint-max) {
.navbar-header > .nav li { display: inline-block !important; }
.nav-badge {
color: $navbar-inverse-link-color;
padding-left: 12px;
padding-right: 12px;
&:hover { color: $navbar-inverse-link-hover-color; }
&:hover,
&:focus {
background-color: transparent;
}
}
#navbar-collapse {
.form-group, .twitter-typeahead {
display: block !important;
margin-bottom: 0;
&, & input { width: 100% }
}
}
}
@media (min-width: $grid-float-breakpoint) {
input[type="search"] {
@include transition(width);
margin-top: 2px;
width: 200px;
&:not(.active) {
background-color: $navbar-inverse-bg;
border-color: $gray-light;
width: 150px;
}
}
#user_menu {
&.open .dropdown-toggle { background-color: darken($navbar-inverse-bg, 7%); }
.dropdown-toggle {
margin: 0 1px;
min-width: 160px;
}
.dropdown-menu {
background-color: darken($navbar-inverse-bg, 7%);
border-top: none;
width: 100%;
& > li > a {
color: $gray-light;
padding-left: 55px;
&:hover {
background-color: $link-color;
color: $gray-lighter;
}
}
}
}
}
.navbar-nav:not(.nav-badges) > li > a { font-weight: bold; }
.nav-badges {
li { height: $navbar-height; }
.dropdown-open {
background-color: $dropdown-bg;
& > a { color: $dropdown-link-color; }
.dropdown-menu { display: block; }
}
.dropdown-menu {
border-top: none;
margin-left: -1px;
padding: 0px;
width: 400px;
.avatar {
width: 35px;
height: 35px;
}
.header {
padding: 10px;
border-bottom: 1px solid $border-grey;
h4 { margin: 5px 0; }
}
.notifications {
position: relative;
max-height: 350px;
}
.stream_element.media {
padding: 5px;
.tooltip { position: fixed; }
.unread-toggle {
margin-right: 10px;
opacity: 1;
}
& > .pull-right > .aspect_membership_dropdown { display: none; }
}
.ajax-loader {
border-bottom: 1px solid $border-grey;
padding: 10px;
.spinner {
height: 30px;
width: 30px;
}
}
.view_all {
background-color: $link-color;
border-top: 3px solid $white;
text-align: center;
a {
color: $white;
display: block;
font-weight: bold;
padding: 5px;
&:hover { text-decoration: none; }
}
}
}
}
[class^="entypo-"], [class*="entypo-"] {
color: inherit;
font-size: $font-size-h3;
vertical-align: middle;
}
.nav-badge {
margin-bottom: -2px;
.badge {
position: absolute;
right: 10px;
top: 10px;
}
}
#user_menu {
.avatar {
height: 30px;
width: 30px;
}
.user-avatar {
height: $navbar-height;
padding: ($navbar-height - 30px)/2 0;
margin-bottom: -$navbar-padding-vertical;
margin-top: -$navbar-padding-vertical;
margin-right: 10px;
}
}
}
......@@ -21,12 +21,4 @@ class ApplicationController < ActionController::Base
end
I18n.locale = l
end
protect_from_forgery with: :exception
protected
def authenticate
authenticate_or_request_with_http_basic('Hi there, please sign in first :-)') do |username, password|
username == USER && password == PASSWORD
end
end
end
class BlogController < ApplicationController
end
class BlogpostsController < ApplicationController
def index
@blogposts = Blogpost.all
end
def show
@blogposts = Blogpost.find(params[:id])
end
def new
@blogposts = Blogpost.new
end
def create
@blogposts = Blogpost.new(post_params)
@blogposts.save
redirect_to blogpost_path(@blogposts)
end
def edit
@blogposts = Blogpost.find(params[:id])
end
def update
@blogposts = Blogpost.find(params[:id])
@blogposts.update(post_params)
redirect_to blogpost_path(@blogposts)
flash.notice = "Article '#{@blogposts.title}' Updated!"
end
def destroy
@blogposts = Blogpost.find(params[:id])
@blogposts.destroy
redirect_to @blogposts
end
def post_params
params.require(:blogpost).permit(:title, :body)
end
end
......@@ -5,4 +5,16 @@ module ApplicationHelper
def logged_in?
not request.authorization.nil?
end
def markdown(content)
@markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, {
autolink: true,
space_after_headers: true,
fenced_code_blocks: true,
underline: true,
highlight: true,
footnotes: true,
tables: true
})
@markdown.render(content)
end
end
module BlogpostsHelper
end
<% if logged_in? %>
<h1>Admin</h1>
<p></p>
<pre id="tail" style="height:400px;">
<%= @logs %>
</pre>
<button type="button" class="btn btn-primary">Refresh</button>
<% content_for(:after) do %>
<script>
var tailcounter = 100;
tailScroll();
window.setInterval(function(){
ajaxCallFunction(); //calling every 5 seconds
}, 5000);
function ajaxCallFunction(){}
$("button").click(function (e) {
$.get('<% @logs %>', function(data) {
$('#tail').html(data)
// e.preventDefault();
// switch (tailswitch) {
// case false:
// clearInterval(t);
// tailswitch = true;
// alert("auto update off");
// break;
// case true:
// t = setInterval(tailappend, 1000);
// tailswitch = false;
// alert("auto update on");
// break;
// }
});
function tailScroll() {
var height = $("#tail").get(0).scrollHeight;
$("#tail").animate({
scrollTop: height
}, 500);
}
</script>
<% end %>
<% else %>
<h1> nope </h1>
<% end %>
<h1>Admin#index</h1>
<p>Find me in app/views/admin/index.html.erb</p>
<%= form_for @blogposts do |f| %>
<ul>
<% @blogposts.errors.full_messages.each do |error| %>
<li><%= error %></li>
<% end %>
</ul>
<p>
<%= f.label :title %><br />
<%= f.text_field :title %>
</p>
<p>
<%= f.label :body %><br />
<%= f.text_area :body %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
<h1>Edit a Post</h1>
<%= render partial: 'form' %>
<h1>All Posts</h1>
<ul id="posts">
<% @blogposts.each do |blogpost| %>
<li>
<%= link_to blogpost.title, blogpost_path(blogpost), class: 'post_title' %>
</li>
<% end %>
</ul>
<%= link_to "Create a New Post", new_blogpost_path, class: "new_post" %>
<h1>New Post</h1>
<%= render partial: 'form' %>
<div class="content">
<h2><%= @blogposts.title %></h2>
<p><%= markdown(@blogposts.body).html_safe %></p>
<hr>
<%= link_to "<< Back to all Posts", blogposts_path %><div style="padding-left:1em;"></div>
<%= link_to "edit", edit_blogpost_path(@blogposts) %><div style="padding-left:1em;"></div>
<%= link_to "delete", blogpost_path(@blogposts), method: :delete, data: {confirm: "Really delete the article?"} %>
</div>
<% content_for :title, t('home.hosting.title') %>
<div align="center">
<h2> <%= t('home.hosting.headline') %></h2>
<p style="color: grey;padding-top:1em;padding-bottom:1em;"> <%= t('home.hosting.description_html') %></p>
<div style="padding-left:4em;padding-right:4em;">
<div class="col-md-6" style="padding-right:2em;">
<div class="list-group">
<button class="list-group-item disabled">
<h5 style="text-align:center;">This is in the package</h5>
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> 24/7 Uptime
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Latest minetest snapshot
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> High performance database system
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Individual servermods
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> SSD under the hood
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Daily Backups
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Easy to use webpanel to control your server (soon)
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Cancel or freeze your server any time you want
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> No disgusting position reset
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Gigabit Lan
</button>
<button type="button" class="list-group-item">
<i class="glyphicon glyphicon-ok" style="color:#5FB065"></i> Ddos protected hostmachine
</button>
</div>
</div>
<div class="col-md-6" style="color:gray;text-align:left">
<div style="padding-top:1em;"></div>
<h5><%= t('home.hosting.ready') %></h5>
<%= t('home.hosting.get_html') %>
<h5><%= t('home.hosting.pay_with') %></h4>
<ul>
<li>PayPal</li>
<li>Bitcoin</li>
<li><%= t('home.hosting.banktransfer') %></li>
</ul>
<h5><%= t('home.hosting.need_to_know') %></h5>
<ul>
<li><%= t('home.hosting.servermods') %></li>
<li><%= t('home.hosting.subgame') %></li>
<li><%= t('home.hosting.players') %></li>
<li><%= t('home.hosting.adminname') %></li>
<li><%= t('home.hosting.public') %></li>
</ul>
<%= t('home.hosting.dont_worry_html') %>
<div style="padding-top:6em;"></div>
<a type="button" class="btn btn-success disabled pull-right">to your webpanel</a>
</div>
</div>
</div>
<%= content_for(:license) do %>
<li><a style="font-weight:400;cursor:pointer;" data-target="#tos" data-toggle="modal"><i class="glyphicon glyphicon-tags"></i> TOS</a></li>
<li>|</li>
<li><a href="//tchncs.de/impressum.html" target="_blank" style="font-weight:400;"><i class="glyphicon glyphicon-tree-deciduous"></i> Impressum</a></li>
<li>|</li>
<div class="modal fade" id="tos" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="f-left"> Terms of Use </h4>
</div>
<div class="modal-body">
<h4><%= t('home.hosting.general_head') %></h4>
<%= t('home.hosting.general_content') %>
<h4><%= t('home.hosting.refund_head') %></h4>
<%= t('home.hosting.refund_content') %>
<h4><%= t('home.hosting.overdue_head') %></h4>
<%= t('home.hosting.overdue_content') %>
<h4><%= t('home.hosting.ressource_head') %></h4>
<%= t('home.hosting.ressource_content') %>
<h4><%= t('home.hosting.mods_head') %></h4>
<%= t('home.hosting.mods_content') %>
<h4><%= t('home.hosting.backups_head') %></h4>
<%= t('home.hosting.backups_content') %>
<h4><%= t('home.hosting.abuse_head') %></h4>
<%= t('home.hosting.abuse_content') %><br><br>
<%= t('home.hosting.change_content') %>
</div>
</div>
</div>
</div>
<% end %>
......@@ -16,6 +16,7 @@
<meta property="og:image" itemprop="image" content="//images.illuna-minetest.tk/icons/logo.png" />
<link rel="shortcut icon" href="//images.illuna-minetest.tk/icons/favicon.ico" type="image/x-icon" />
<link href='//assets.illuna-minetest.tk/css/page.css' rel="stylesheet" type="text/css">
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= yield(:stylesheet) %>
</head>
<body link="#c7c7c7" vlink="#c7c7c7" alink="#c7c7c7">
......@@ -92,7 +93,8 @@
</div>
</div>
</footer>
<script src="//assets.illuna-minetest.tk/js/jquery.min.js"></script>
<script src="//assets.illuna-minetest.tk/js/jquery.min.js"></script>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<script src="//assets.illuna-minetest.tk/bootstrap/js/bootstrap.min.js"></script>
<script src="//assets.illuna-minetest.tk/js/firefly.js"></script>
<script>$.firefly({color:'#c46430',minPixel:1,maxPixel:3,total:20,on:'body',borderRadius:"50%",});</script>
......
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
mysql: &mysql
adapter: mysql2
host: "localhost"
port: 3306
username: "root"
password: "Neuzeit32"
# socket: /tmp/mysql.sock
encoding: utf8mb4
collation: utf8mb4_bin
development:
<<: *default
database: db/development.sqlite3
postgresql: &postgresql
adapter: postgresql
host: 127.0.0.1
port: 5432
username: technics
password: Neuzeit32
encoding: unicode
# Comment the the mysql line and uncomment the postgres line
# if you want to use postgres
common: &common
# Choose one of the following
<<: *postgresql
#<<: *mysql
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
##################################################
#### CONFIGURE ABOVE #############################
##################################################
# Normally you don't need to touch anything here
combined: &combined
<<: *common
development:
<<: *combined
database: illunahp_development
production:
<<: *default
database: db/production.sqlite3
<<: *combined
database: illunahp_production
test:
<<: *combined
database: illunahp_test
integration1:
<<: *combined
database: illunahp_integration1
integration2:
<<: *combined
database: illunahp_integration2
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
# You can make any of these extensions optional by
# renaming `b.use` to `b.optional`.
# Determines whether to use HTML5 (:email, :url, ...)
# and required attributes
b.use :html5
# Calculates placeholders automatically from I18n
# You can also pass a string as f.input placeholder: "Placeholder"
b.use :placeholder
## Optional extensions
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
# if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
b.optional :maxlength
# Calculates pattern from format validations for string inputs
b.optional :pattern
# Calculates min and max from length validations for numeric inputs
b.optional :min_max
# Calculates readonly automatically from readonly attributes
b.optional :readonly
## Inputs
b.use :label_input
b.use :hint, wrap_with: { tag: :span, class: :hint }
b.use :error, wrap_with: { tag: :span, class: :error }
## full_messages_for
# If you want to display the full error message for the attribute, you can
# use the component :full_error, like:
#
# b.use :full_error, wrap_with: { tag: :span, class: :error }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :default
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :nested
# Default class for buttons