only slightly trimmed volt new output
This commit is contained in:
1
app/main/assets/css/app.css.scss
Normal file
1
app/main/assets/css/app.css.scss
Normal file
@ -0,0 +1 @@
|
||||
// Place your apps css here
|
8
app/main/config/dependencies.rb
Normal file
8
app/main/config/dependencies.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# Specify which components you wish to include when
|
||||
# the "home" component loads.
|
||||
|
||||
# bootstrap css framework
|
||||
component 'bootstrap'
|
||||
|
||||
# a default theme for the bootstrap framework
|
||||
component 'bootstrap_jumbotron_theme'
|
10
app/main/config/initializers/boot.rb
Normal file
10
app/main/config/initializers/boot.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# Place any code you want to run when the component is included on the client
|
||||
# or server.
|
||||
|
||||
# To include code only on the client use:
|
||||
# if RUBY_PLATFORM == 'opal'
|
||||
#
|
||||
# To include code only on the server, use:
|
||||
# unless RUBY_PLATFORM == 'opal'
|
||||
# ^^ this will not send compile in code in the conditional to the client.
|
||||
# ^^ this include code required in the conditional.
|
7
app/main/config/routes.rb
Normal file
7
app/main/config/routes.rb
Normal file
@ -0,0 +1,7 @@
|
||||
# See https://github.com/voltrb/volt#routes for more info on routes
|
||||
|
||||
client '/about', action: 'about'
|
||||
|
||||
# The main route, this should be last. It will match any params not
|
||||
# previously matched.
|
||||
client '/', {}
|
27
app/main/controllers/main_controller.rb
Normal file
27
app/main/controllers/main_controller.rb
Normal file
@ -0,0 +1,27 @@
|
||||
# By default Volt generates this controller for your Main component
|
||||
module Main
|
||||
class MainController < Volt::ModelController
|
||||
def index
|
||||
# Add code for when the index view is loaded
|
||||
end
|
||||
|
||||
def about
|
||||
# Add code for when the about view is loaded
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# The main template contains a #template binding that shows another
|
||||
# template. This is the path to that template. It may change based
|
||||
# on the params._component, params._controller, and params._action values.
|
||||
def main_path
|
||||
"#{params._component || 'main'}/#{params._controller || 'main'}/#{params._action || 'index'}"
|
||||
end
|
||||
|
||||
# Determine if the current nav component is the active one by looking
|
||||
# at the first part of the url against the href attribute.
|
||||
def active_tab?
|
||||
url.path.split('/')[1] == attrs.href.split('/')[1]
|
||||
end
|
||||
end
|
||||
end
|
12
app/main/models/user.rb
Normal file
12
app/main/models/user.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# By default Volt generates this User model which inherits from Volt::User,
|
||||
# you can rename this if you want.
|
||||
class User < Volt::User
|
||||
# login_field is set to :email by default and can be changed to :username
|
||||
# in config/app.rb
|
||||
field login_field
|
||||
field :name
|
||||
|
||||
validate login_field, unique: true, length: 8
|
||||
validate :email, email: true
|
||||
|
||||
end
|
7
app/main/views/main/about.html
Normal file
7
app/main/views/main/about.html
Normal file
@ -0,0 +1,7 @@
|
||||
<:Title>
|
||||
About
|
||||
|
||||
<:Body>
|
||||
<h1>About</h1>
|
||||
|
||||
<p>About page...</p>
|
6
app/main/views/main/index.html
Normal file
6
app/main/views/main/index.html
Normal file
@ -0,0 +1,6 @@
|
||||
<:Title>
|
||||
Home
|
||||
|
||||
<:Body>
|
||||
<h1>Home</h1>
|
||||
|
27
app/main/views/main/main.html
Normal file
27
app/main/views/main/main.html
Normal file
@ -0,0 +1,27 @@
|
||||
<:Title>
|
||||
{{ view main_path, "title", {controller_group: 'main'} }}
|
||||
|
||||
<:Body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<ul class="nav nav-pills pull-right">
|
||||
<:nav href="/">Home</:nav>
|
||||
<:nav href="/about">About</:nav>
|
||||
</ul>
|
||||
<h3 class="text-muted">salama-debugger</h3>
|
||||
</div>
|
||||
|
||||
<:volt:notices />
|
||||
|
||||
{{ view main_path, 'body', {controller_group: 'main'} }}
|
||||
|
||||
<div class="footer">
|
||||
<p>© Company {{ Time.now.year }}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<:Nav>
|
||||
<li class="{{ if active_tab? }}active{{ end }}">
|
||||
<a href="{{ attrs.href }}">{{ yield }}</a>
|
||||
</li>
|
Reference in New Issue
Block a user