Redesign default.haml and add a podmin welcome page

This commit is contained in:
Steffen van Bergerem 2016-06-19 21:05:42 +02:00
parent 03f6420ffd
commit b1943f1e46
No known key found for this signature in database
GPG key ID: 2F08F75F9525C7E0
17 changed files with 246 additions and 182 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,014 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -5,7 +5,7 @@
@import 'mixins';
/* core */
// core
@import 'media-box';
@import 'entypo';
@import 'icons';
@ -24,59 +24,62 @@
@import 'colors';
@import 'card-footer';
/* font overrides */
// font overrides
@import 'typography';
// layout
@import 'sidebar';
/* login */
// home
@import 'home';
// login
@import 'login';
@import 'registration';
@import 'forms';
/* terms */
// terms
@import 'terms';
/* profile and settings pages */
// profile and settings pages
@import 'settings';
/* new SPV */
// new SPV
@import 'header';
@import 'footer';
@import 'opengraph';
@import 'single-post-view';
@import 'poll';
/* map*/
// map
@import 'leaflet';
@import 'map';
/* conversations */
// conversations
@import 'conversations';
/* publisher */
// publisher
@import 'publisher';
@import 'aspects';
/* bookmarklet */
// bookmarklet
@import 'bookmarklet';
/* notifications */
// notifications
@import 'notifications';
/* help */
// help
@import 'help';
/* getting started */
// getting started
@import 'getting-started';
/* people */
// people
@import 'people';
@import 'invitations';
@import 'profile';
/* stream */
// stream
@import 'tag';
@import 'stream';
@import 'stream_element';
@ -87,18 +90,18 @@
@import 'oembed';
@import 'post-content';
/* contacts */
// contacts
@import 'contacts';
@import 'navbar_left';
/* code */
// code
@import 'code';
@import 'highlightjs/github';
/* statistics */
// statistics
@import 'statistics';
/* gallery */
// gallery
@import 'blueimp-gallery';
@import 'blueimp-gallery/blueimp-gallery-indicator';
@import 'gallery';

View file

@ -1,87 +1,56 @@
@import 'color-variables';
@import 'bootstrap-variables';
.page-home {
background-color: $main-background;
body {
margin-top: $navbar-height;
background-color: white;
background-image : none;
}
li {
list-style: none;
}
footer h3 {
margin-bottom: 25px;
text-align: center;
}
footer {
margin-bottom: 12px;
padding: 42px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
width: auto
}
#header {
/* Hack to hide the header */
box-shadow:none;
border:none;
background:none;
left: 0px;
padding: 15px 0px;
}
#header img {
margin-left: 15px;
}
#login-link {
float: right;
margin-right: 15px;
}
#steps {
text-align: center;
}
#banner {
border-bottom : 1px solid #ccc;
border-top : 1px solid #eee;
padding : 30px;
margin-top: 20px;
text-align: center;
box-shadow : 0 9px 15px -10px rgba(0,0,0,0.7);
}
#links {
margin: 0;
padding: 0;
text-align: center;
}
#links .section {
margin: 0;
padding: 0;
display: inline-block;
vertical-align: top;
width: 24%;
max-width: 24%;
}
#change-page {
color: #999;
text-align: center;
font-style: italic;
}
.helpful {
cursor: help;
}
.row {
margin-bottom: 60px;
h3 {
border-bottom: 1px dashed $border-grey;
font-weight: bold;
margin: 0 0 15px;
padding-bottom: 15px;
}
.container-fluid.home-user {
padding-bottom: 75px;
padding-top: 75px;
}
.dandelion-background {
background: image-url('dandelion.jpg');
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.jumbotron {
background-color: rgba($black, .4);
margin-bottom: 0;
h1,
h2 {
color: $white;
font-weight: bold;
text-shadow: 0 2px 2px $black;
}
}
.landing-info-card {
background-color: $white;
border: 1px solid $light-grey;
box-shadow: $card-shadow;
margin-bottom: 25px;
margin-top: 25px;
min-height: 150px;
padding: 15px;
}
.login-form {
fieldset { background: none; }
.block-form {
background-color: rgba($white, .25);
border-radius: 5px;
margin: 0;
max-width: 400px;
padding: 1em;
}
}
}

View file

@ -19,12 +19,17 @@ class HomeController < ApplicationController
partial_dir.join("_show.html.erb").exist? ||
partial_dir.join("_show.haml").exist?
render :show
elsif User.count > 1 && Role.where(name: "admin").any?
render :default
else
render :default,
layout: "application"
redirect_to podmin_path
end
end
def podmin
render :podmin
end
def toggle_mobile
session[:mobile_view] = session[:mobile_view].nil? ? true : !session[:mobile_view]

View file

@ -1,64 +1,27 @@
- content_for(:head) do
= stylesheet_link_tag :home, media: "all"
.dandelion-background
.jumbotron
.container-fluid.home-user
.row
.col-md-8.text-center
%h1= t("home.default.headline", pod_name: pod_name)
%h2= t("home.default.byline")
.col-md-4.login-form
= render partial: "sessions/form", locals: {mobile: false, resource: User.new, resource_name: :user}
#page.container
%header#header
%a#login-link.btn.btn-default{href: "login"} Log In
= image_tag "branding/logos/logo.png"
#banner.row
%h1 Welcome, friend.
%h3 You're about to change the Internet. Let's get you set up, shall we?
#steps.row
.container-fluid
.row
.col-md-4
%h2
Configure your
%abbr.helpful{title: "A Diaspora installation"} pod
= image_tag "landing/cog.png"
%p
Look at
%code.helpful{title: "General pod configuration (location to upload photos, SSL certs, etc.)"}
config/diaspora.yml.example
and
%code.helpful{title: "MySQL username/password"}
config/database.yml.example
for help.
.landing-info-card
%h3.text-center
= t(".own_your_data")
= t(".own_your_data_info")
.col-md-4
%h2 Try it out
= image_tag "landing/smiley_laughing.png"
%p
Start by
= link_to "creating an account", new_user_registration_path
.landing-info-card
%h3.text-center
= t(".choose_your_audience")
= t(".choose_your_audience_info")
.col-md-4
%h2 Make a contribution!
= image_tag "landing/pen_write.png"
%p
Make Diaspora even better! Fork the project on
= link_to "Github", "http://github.com/diaspora/diaspora"
make some changes, and submit a pull request.
%footer
%h3 Useful Resources
%ul#links
%ul.section
%li= link_to "Codebase", "http://github.com/diaspora/diaspora", title: "Git repository"
%li= link_to "Documentation", "http://wiki.diasporafoundation.org", title: "Project wiki"
%ul.section
%li= link_to "IRC - General", "http://webchat.freenode.net/?channels=diaspora", title: "#diaspora"
%li= link_to "IRC - Development", "http://webchat.freenode.net/?channels=diaspora-dev", title: "#diaspora-dev"
%ul.section
%li= link_to "Discussion - General", "http://groups.google.com/group/diaspora-discuss", title: "General discussion mailing list"
%li= link_to "Discussion - Development", "http://groups.google.com/group/diaspora-dev", title: "Dev mailing list"
%ul.section
%li= link_to "Find & Report bugs", "https://github.com/diaspora/diaspora/issues", title: "Bug tracker"
%li= link_to "Learn more about Ruby On Rails!", "http://guides.rubyonrails.org/"
#change-page
This page can be changed to a custom landing page by creating
%code app/views/home/_show.html.haml
.landing-info-card
%h3.text-center
= t(".be_who_you_want_to_be")
= t(".be_who_you_want_to_be_info")

View file

@ -0,0 +1,61 @@
.dandelion-background
.jumbotron
.container-fluid.home-podmin
.row
.col-md-12.text-center
%h1= t(".headline")
%h2= t(".byline")
.container-fluid
.row
.col-md-4
.landing-info-card
%h3.text-center
.entypo-tools
= t(".configure_your_pod")
!= t(".configuration_info",
database_path: content_tag(:code, "config/database.yml"),
diaspora_path: content_tag(:code, "config/diaspora.yml"))
.col-md-4
.landing-info-card
%h3.text-center
.entypo-add-user
= t(".create_an_account")
!= t(".create_an_account_info",
sign_up_link: link_to(t("devise.shared.links.sign_up"), new_user_registration_path))
.col-md-4
.landing-info-card
%h3.text-center
.entypo-key
= t(".make_yourself_an_admin")
!= t(".make_yourself_an_admin_info",
wiki: link_to("diaspora* wiki", "https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers#What_are_roles_and_how_do_I_use_them.3F_.2F_Make_yourself_an_admin"),
admin_panel: link_to(t(".admin_panel"), "/admin_panel"))
.row
.col-md-4
.landing-info-card
%h3.text-center
.entypo-new
= t(".update_your_pod")
!= t(".update_your_pod_info",
update_instructions: link_to(t(".update_instructions"), "https://wiki.diasporafoundation.org/Updating"))
.col-md-4
.landing-info-card
%h3.text-center
.entypo-lifebuoy
= t(".getting_help")
!= t(".getting_help_info",
faq: link_to(t(".faq_for_podmins"), "https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers"),
irc: link_to(t(".contact_irc"), "https://wiki.diasporafoundation.org/How_We_Communicate#IRC"))
.col-md-4
.landing-info-card
%h3.text-center
.entypo-code
= t(".contribute")
!= t(".contribute_info",
report_bugs: link_to(t(".report_bugs"), "https://wiki.diasporafoundation.org/How_to_report_a_bug"))

View file

@ -32,10 +32,8 @@
<![endif]-->
= jquery_include_tag
- unless @landing_page
= javascript_include_tag :main, :templates
= load_javascript_locales
= javascript_include_tag :main, :templates
= load_javascript_locales
= translation_missing_warnings
= current_user_atom_tag

View file

@ -84,7 +84,6 @@ module Diaspora
error_pages.css
admin.css
rtl.css
home.css
color_themes/*/desktop.css
color_themes/*/mobile.css
}

View file

@ -3,6 +3,5 @@ if AppConfig.environment.image_redirect_url.present?
Rails.application.config.middleware.insert(0, Rack::Rewrite) do
r301 %r{/uploads/images/(.*)}, "#{AppConfig.environment.image_redirect_url}/uploads/images/$1"
r301 %r{/landing/(.*)}, "#{AppConfig.environment.image_redirect_url}/landing/$1"
end
end

View file

@ -592,6 +592,37 @@ en:
diaspora_app_q: "Is there a diaspora* app for Android or iOS?"
diaspora_app_a: "There have been several Android apps in development by community members. Some are long-abandoned projects and so do not work well with the current version of diaspora*. Dont expect much from these apps at the moment. There is currently no app for iOS. The best way to access diaspora* from your mobile device is through a browser, because weve designed a mobile version of the site which should work well on all devices, although it does not yet have complete functionality."
home:
default:
headline: "Welcome to %{pod_name}"
byline: "The online social world where you are in control"
be_who_you_want_to_be: "Be who you want to be"
be_who_you_want_to_be_info: "A lot of networks insist that you use your real identity. Not diaspora*. Here you can choose who you want to be, and share as much or as little about yourself as you want. It really is up to you how you want to interact with other people."
choose_your_audience: "Choose your audience"
choose_your_audience_info: "diaspora*s aspects allow you to share with just those people you want to. You can be as public or as private as you like. Share a funny photo with the whole world, or a deep secret just with your closest friends. Youre in control."
own_your_data: "Own your own data"
own_your_data_info: "Many networks use your data to make money by analysing your interactions and using this information to advertise things to you. diaspora* doesnt use your data for any purpose other than allowing you to connect and share with others."
podmin:
headline: "Welcome, friend."
byline: "Youre about to change the Internet. Lets get you set up, shall we?"
configure_your_pod: "Configure your pod"
create_an_account: "Create an account"
make_yourself_an_admin: "Make yourself an admin"
update_your_pod: "Update your pod"
getting_help: "Getting help"
contribute: "Contribute"
configuration_info: "Open %{database_path} and %{diaspora_path} in your favourite text editor and carefully review them, they are extensively commented."
create_an_account_info: "%{sign_up_link} for a new account."
make_yourself_an_admin_info: "You can find instructions in the %{wiki}. This should add an “Admin” link to your user menu in the header when you are logged in. It gives you stuff like user search and stats for your pod. For intense detail on the operational aspects of your pod, go to the %{admin_panel}."
admin_panel: "admin panel"
update_your_pod_info: "You can find %{update_instructions}."
update_instructions: "update instructions in the diaspora* wiki"
getting_help_info: "We listed some %{faq} including some additional tips and tricks and solutions for the most common problems. Also feel free to %{irc}."
faq_for_podmins: "FAQ for pod maintainers in our wiki"
contact_irc: "contact us on IRC"
contribute_info: "Make diaspora* even better! If you find any bugs please %{report_bugs}."
report_bugs: "report them"
invitation_codes:
excited: "%{name} is excited to see you here."
not_valid: "That invite code is no longer valid"

View file

@ -229,6 +229,7 @@ Diaspora::Application.routes.draw do
# Startpage
root :to => 'home#show'
get "podmin", to: "home#podmin"
api_version(module: "Api::V0", path: {value: "api/v0"}, default: true) do
match "user", to: "users#show", via: %i(get post)

View file

@ -3,3 +3,7 @@ the Diaspora frontend. This includes GIMP files, Photoshop files, SVG
files, and all other image files of this sort. They are not shown directly
to end users, but are used to generate the actual graphics used in the
frontend (PNGs, etc.). They can be scaled, tinted, shaded, etc.
## License
[dandelion.jpg](https://www.flickr.com/photos/pixagraphic/7218285148/) by pixagraphic has been released under [CC-BY-ND](https://creativecommons.org/licenses/by-nd/2.0/)

BIN
graphics/dandelion.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

View file

@ -6,25 +6,56 @@ require "spec_helper"
describe HomeController, type: :controller do
describe "#show" do
it "does not redirect for :html" do
it "does not redirect for :html if there are at least 2 users and an admin" do
allow(User).to receive(:count).and_return(2)
allow(Role).to receive_message_chain(:where, :any?).and_return(true)
allow(Role).to receive_message_chain(:where, :exists?).and_return(true)
get :show
expect(response).not_to be_redirect
end
it "redirects for :mobile" do
it "redirects to the podmin page for :html if there are less than 2 users" do
allow(User).to receive(:count).and_return(1)
allow(Role).to receive_message_chain(:where, :any?).and_return(true)
get :show
expect(response).to redirect_to(podmin_path)
end
it "redirects to the podmin page for :html if there is no admin" do
allow(User).to receive(:count).and_return(2)
allow(Role).to receive_message_chain(:where, :any?).and_return(false)
get :show
expect(response).to redirect_to(podmin_path)
end
it "redirects to the podmin page for :html if there are less than 2 users and no admin" do
allow(User).to receive(:count).and_return(0)
allow(Role).to receive_message_chain(:where, :any?).and_return(false)
get :show
expect(response).to redirect_to(podmin_path)
end
it "redirects to the sign in page for :mobile" do
get :show, format: :mobile
expect(response).to redirect_to(user_session_path)
end
context "redirection" do
before do
sign_in alice
end
it "redirects to the stream if the user is signed in" do
sign_in alice
get :show, home: true
expect(response).to redirect_to(stream_path)
end
end
it "points to the stream if a user has contacts" do
get :show, home: true
expect(response).to redirect_to(stream_path)
end
describe "#podmin" do
it "succeeds" do
get :podmin
expect(response).to be_success
end
it "succeeds on mobile" do
get :podmin, format: :mobile
expect(response).to be_success
end
end