This repository has been archived by the owner on Jun 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: .gitignore app/views/layouts/application.html.erb Yep.
- Loading branch information
Showing
17 changed files
with
204 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Place all the styles related to the Admins controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Less here: http://lesscss.org/ | ||
|
||
.box_sizing() { | ||
-moz-box-sizing: border-box; | ||
-webkit-box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
|
||
|
||
input, textarea, select, .uneditable-input { | ||
border: 1px solid #bbb; | ||
width: 100%; | ||
margin-bottom: 15px; | ||
.box_sizing; | ||
} | ||
|
||
input { | ||
height: auto !important; | ||
} | ||
|
||
#error_explanation { | ||
color: #f00; | ||
ul { | ||
list-style: none; | ||
margin: 0 0 18px 0; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,6 @@ | |
*= require_self | ||
*= require_tree . | ||
*/ | ||
/* | ||
*= require twitter/bootstrap | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
// Place all the styles related to the StaticPages controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Less here: http://lesscss.org/ | ||
|
||
.box_sizing { | ||
-moz-box-sizing: border-box; | ||
-webkit-box-sizing: border-box; | ||
box-sizing: border-box; | ||
} | ||
|
||
|
||
input, textarea, select, .uneditable-input { | ||
border: 1px solid #bbb; | ||
width: 100%; | ||
margin-bottom: 15px; | ||
.box_sizing; | ||
} | ||
|
||
input { | ||
height: auto !important; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
class AdminsController < ApplicationController | ||
def new | ||
@admin = Admin.new | ||
end | ||
|
||
def show | ||
@admin = Admin.find(params[:id]) | ||
end | ||
|
||
def create | ||
@admin = Admin.new(admin_params) | ||
if @admin.save | ||
flash[:success] = "Welcome to the Solar Explorer!" | ||
redirect_to @admin | ||
else | ||
render 'new' | ||
end | ||
end | ||
|
||
private | ||
def admin_params | ||
params.require(:admin).permit(:name, :email, :password, | ||
:password_confirmation) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module AdminsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<% provide(:title, "Administrator sign up") %> | ||
<h1>Administrator sign up</h1> | ||
<div class="row"> | ||
<div class="col-md-6 col-md-offset-3"> | ||
<%= form_for(@admin) do |f| %> | ||
<%= render 'shared/error_messages' %> | ||
|
||
<%= f.label :name %> | ||
<%= f.text_field :name %> | ||
|
||
<%= f.label :email %> | ||
<%= f.text_field :email %> | ||
|
||
<%= f.label :password %> | ||
<%= f.password_field :password %> | ||
|
||
<%= f.label :password_confirmation, "Confirmation" %> | ||
<%= f.password_field :password_confirmation %> | ||
|
||
<%= f.submit "Create new admin", class: "btn btn-large btn-primary" %> | ||
<% end %> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<% provide(:title, @admin.name) %> | ||
<h1><%= "Profil für #{@admin.name}" %></h1> | ||
<p><%= "Name: #{@admin.name}, E-Mail: #{@admin.email }" %></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<% if @admin.errors.any? %> | ||
<div id="error_explanation"> | ||
<div class="alert alert-error"> | ||
The form contains <%= pluralize(@admin.errors.count, "error") %>. | ||
</div> | ||
<ul> | ||
<% @admin.errors.full_messages.each do |msg| %> | ||
<li>* <%= msg %></li> | ||
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<% provide(:title, 'Impressum') %> | ||
<h1>Hauptseite/h1> | ||
<% provide(:title, 'Home') %> | ||
<div class="page-header"> | ||
<h1>Hauptseite</h1> | ||
</div> | ||
<p> | ||
Schauen sie mal, was für ein Boot... | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FactoryGirl.define do | ||
factory :admin do | ||
name "Martin Meyerhoff" | ||
email "[email protected]" | ||
password "foobar" | ||
password_confirmation "foobar" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
require 'spec_helper' | ||
|
||
describe "Admin pages" do | ||
|
||
subject { page } | ||
|
||
describe "profile page" do | ||
let(:admin) { FactoryGirl.create(:admin) } | ||
before { visit admin_path(admin) } | ||
|
||
it { should have_content(admin.name) } | ||
it { should have_title(admin.name) } | ||
end | ||
describe "signup page" do | ||
before { visit new_admin_path } | ||
|
||
it { should have_content('Administrator sign up') } | ||
it { should have_title('Administrator sign up') } | ||
end | ||
|
||
describe "signup" do | ||
|
||
before { visit new_admin_path } | ||
|
||
let(:submit) { "Create new admin" } | ||
|
||
describe "with invalid information" do | ||
it "should not create a user" do | ||
expect { click_button submit }.not_to change(Admin, :count) | ||
end | ||
end | ||
|
||
describe "with valid information" do | ||
before do | ||
fill_in "Name", with: "Example User" | ||
fill_in "Email", with: "[email protected]" | ||
fill_in "Password", with: "foobar" | ||
fill_in "Confirmation", with: "foobar" | ||
end | ||
|
||
it "should create a user" do | ||
expect { click_button submit }.to change(Admin, :count).by(1) | ||
end | ||
|
||
describe "after saving the user" do | ||
before { click_button submit } | ||
let(:admin) { Admin.find_by(email: '[email protected]') } | ||
|
||
it { should have_title(admin.name) } | ||
it { should have_selector('div.alert.alert-success', text: 'Welcome') } | ||
end | ||
end | ||
end | ||
|
||
end |