Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/update project #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source 'https://rubygems.org'

gem 'sinatra'
gem 'thin'
9 changes: 8 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
GEM
remote: https://rubygems.org/
specs:
daemons (1.3.1)
eventmachine (1.2.7)
mustermann (1.0.1)
rack (2.0.3)
rack-protection (2.0.0)
Expand All @@ -10,13 +12,18 @@ GEM
rack (~> 2.0)
rack-protection (= 2.0.0)
tilt (~> 2.0)
thin (1.7.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
tilt (2.0.8)

PLATFORMS
ruby

DEPENDENCIES
sinatra
thin

BUNDLED WITH
1.16.0
1.17.2
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
Hello!
====
# Hello

This is a demonstrator for [Sinatra](http://www.sinatrarb.com/) and [Twitter Bootstrap](http://getbootstrap.com/).
This is a demonstrator for [Sinatra](http://www.sinatrarb.com/) and [Bootstrap](http://getbootstrap.com/).

Use it as a boilerplate to start your own apps.

Go!
===
## Go

Download and run sinatra-bootstrap:

git clone https://github.com/bootstrap-ruby/sinatra-bootstrap

cd sinatra-bootstrap
bundle install # To install sinatra

bundle exec ruby app.rb # To run the sample
bundle install # To install sinatra

Then open [http://localhost:4567/](http://localhost:4567/)
bundle exec rackup # To run the sample

What's next?
============
- Try the rerun gem to restart Sinatra automatically when you change source files: https://github.com/alexch/rerun
Then open [http://localhost:9292/](http://localhost:9292/)

## What's next

- Try the rerun gem to restart Sinatra automatically when you change source files: <https://github.com/alexch/rerun>
3 changes: 1 addition & 2 deletions app.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'rubygems'
require 'sinatra'

configure do
Expand All @@ -24,7 +23,7 @@ def username
end

get '/login/form' do
erb :login_form
erb :login_form, :layout => :layout
end

post '/login/attempt' do
Expand Down
5 changes: 5 additions & 0 deletions config.ru
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
require 'rubygems'
require 'bundler'
require './app'

Bundler.require

run Sinatra::Application
36 changes: 18 additions & 18 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,36 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
</head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</head>
<body>
<div class="container">

<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="/">Sinatra + Twitter Bootstrap</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%=username%>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="/login/form">Login</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/logout">Logout</a>
</div>
</li>
</ul>
<div class="nav-item dropdown text-right">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= username %>
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="/login/form">Log in</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/logout">Log out</a>
</div>
</div>
</div>
</nav>

<div>
<%if @error then %>
<div class="alert alert-error"><%=@error%></div>
Expand All @@ -47,9 +47,9 @@
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>

2 changes: 1 addition & 1 deletion views/login_form.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form action='/login/attempt' method='post' class="form-inline well">
<input type="text" name='username' placeholder="username" autofocus>
<input class="btn primary" type='submit' value='log in'>
<input class="btn btn-outline-primary ml-4" type='submit' value='log in'>
</form>