My own first Rails project is online! After weeks of development, reading hundreds of panels, drinking a lot of Mate bottles, today the relaunch happened. Feel free to visit VegiKochbuch and be a part of it!
My own first Rails project is online! After weeks of development, reading hundreds of panels, drinking a lot of Mate bottles, today the relaunch happened. Feel free to visit VegiKochbuch and be a part of it!
The idea was to generate badges for different types of users on the fly. Just by defining a new color. The solution is using an UTF-8 character for the corner: ◤ U+25E4
You can see the example page here:
CSS3-badges
<meta charset="utf-8">
.badge {
font-family: Arial,san-serif;
font-size: 10px;
line-height: 1em;
padding: 0px 15px 0px 3px;
text-transform: uppercase;
border: 1px solid #ccc;
color: #666666;
position: relative;
background: #f1f1f1;
}
.badge:before {
content: '\25E4';
width: 12px;
height: 12px;
display: block;
background: #fff;
position: absolute;
right: -1px;
bottom: -1px;
font-size: 15px;
line-height: 10px;
color: #bdbdbd;
}
.badge:hover {
color: #2D3441;
cursor: pointer;
}
<span class="badge" title="Default Badge">Default Badge</span>
On a new project I wanted to have an footer navigation across a range of WordPress Multisite blogs. This is my solution:
<?php $current_blog = get_current_blog_id(); ?>
<?php switch_to_blog(1); ?>
<ul>
<?php wp_list_pages( 'show_home=1&title_li=<h3>'.get_bloginfo('name').'</h3>&depth=1' ); ?>
</ul>
<?php switch_to_blog(2); ?>
<ul>
<?php wp_list_pages( 'show_home=1&title_li=<h3>'.get_bloginfo('name').'</h3>&depth=1' ); ?>
</ul>
...
<?php switch_to_blog($current_blog); ?>
If you use switch_to_blog just once you don’t need the $current_blog and you can switch back easy using restore_current_blog().
WordPress Function Reference / switch to blog
The project URL is coming soon.
How to create static pages, for example legal notice, on a Rails project.
./script/rails generate controller Static
The controller code:
class StaticController < ApplicationController
def method_missing(name)
render :template => "static/#{name}"
end
end
In your config/routes.rb add one line for every static page:
match 'legal_notice' => 'static#legal_notice'
Create a new directory app/views/static and add your page legal_notice.html.haml
Now go to http://your-application.com/legal_notice – that’s all.