templates-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -14
- data/app/controllers/{templates/templates_controller.rb → templates_controller.rb} +1 -1
- data/app/views/layouts/templates/index.html.erb +1 -1
- data/app/views/templates/{templates/index.html.erb → index.html.erb} +1 -1
- data/app/views/templates/{templates/nested_index.html.erb → nested_index.html.erb} +1 -1
- data/config/routes.rb +1 -1
- data/lib/templates/engine.rb +6 -2
- data/lib/templates/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27beefad8d889787f2000e3b075ffb766f352a7d69d113ecad7329dcde401aad
|
4
|
+
data.tar.gz: 0602cac538c208fe5165f5272ebd6985cf18ce444c6c14e34b947be2660661a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfce54de7c40c3e7eb8aa6c526746b1dcdb4518d8cb958cf1a13a1e509c2db305b9b55d706280a036e9e7de4c1082c0b06050dddabd2e3564803bdf611b4b2de
|
7
|
+
data.tar.gz: 282a32a5cbc54a7ebe963fcd6288b157630de02741184f2f1b947efc230344609c9e61306a62ead963e4d65c98e0c8645717930fe98f90e4633204edc48fb869
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Templates
|
2
|
-
[![Gem Version](
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/templates-rails.svg)](https://badge.fury.io/rb/templates-rails)
|
3
3
|
[![Rspec](https://github.com/Ancez/templates-rails/actions/workflows/rspec.yml/badge.svg)](https://github.com/Ancez/templates-rails/actions/workflows/rspec.yml)
|
4
|
-
[![Ruby Gem](https://github.com/Ancez/templates-rails/actions/workflows/gem-push.yml/badge.svg)](https://rubygems.org/gems/templates-rails)
|
5
4
|
|
6
5
|
Simple to use templating system for your Rails application. Design your views before implementation.
|
7
6
|
|
@@ -9,7 +8,7 @@ Dummy can be viewed [here](https://templates-rails.herokuapp.com/).
|
|
9
8
|
|
10
9
|
## Installation
|
11
10
|
|
12
|
-
Add this line to your application's Gemfile:
|
11
|
+
Add this line to your application's Gemfile under the `:development` group:
|
13
12
|
|
14
13
|
```ruby
|
15
14
|
gem 'templates-rails'
|
@@ -17,24 +16,20 @@ gem 'templates-rails'
|
|
17
16
|
|
18
17
|
And then execute:
|
19
18
|
|
20
|
-
|
19
|
+
bundle install
|
21
20
|
|
22
21
|
Or install it yourself as:
|
23
22
|
|
24
|
-
|
23
|
+
gem install templates-rails --group development
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
-
|
30
|
-
- `mount Templates::Engine => '/'`
|
31
|
-
- And will automatically generate `views/templates/example` directory and an example `.html.erb` file `/views/templates/example.html.erb`
|
32
|
-
- It will also generate empty `partials` directories to showcase that you can still partialise your design views with a structure
|
33
|
-
- `partials` directories are excluded from being shown within the indexes
|
25
|
+
## TODO
|
26
|
+
- Finish the install rake task to generate the `templates` directory
|
27
|
+
- Setup a rake task for generating the layouts so users can pick their layouts
|
28
|
+
- Finish the specs
|
34
29
|
|
35
30
|
## Usage
|
31
|
+
- `partials` directories get ignored within the `views/templates` directory
|
36
32
|
|
37
|
-
The rake task mentioned above generates examples for you to edit, delete and/or copy from.
|
38
33
|
|
39
34
|
## Development
|
40
35
|
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class="templates__header">
|
12
12
|
<div>
|
13
13
|
<h1><%= yield(:title) if content_for?(:title) %></h1>
|
14
|
-
<%= link_to 'Go Back',
|
14
|
+
<%= link_to 'Go Back', templates_engine.root_path if params[:id].present? %>
|
15
15
|
</div>
|
16
16
|
</div>
|
17
17
|
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
<div>
|
4
4
|
<% Dir.children('./app/views/templates').excluding('partials').sort.each do |child| %>
|
5
|
-
<%= link_to child.chomp('.html.erb').humanize.titleize, template_path(child.chomp('.html.erb')), class: 'button button--blue' %>
|
5
|
+
<%= link_to child.chomp('.html.erb').humanize.titleize, templates_engine.template_path(child.chomp('.html.erb')), class: 'button button--blue' %>
|
6
6
|
<% end %>
|
7
7
|
</div>
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
<div>
|
4
4
|
<% Dir.children("./app/views/templates/#{params[:id]}").excluding('partials').sort.each do |child| %>
|
5
|
-
<%= link_to child.chomp('.html.erb').humanize.titleize, template_path("#{params[:id]}/#{child.chomp('.html.erb')}"), class: 'button button--blue' %>
|
5
|
+
<%= link_to child.chomp('.html.erb').humanize.titleize, templates_engine.template_path("#{params[:id]}/#{child.chomp('.html.erb')}"), class: 'button button--blue' %>
|
6
6
|
<% end %>
|
7
7
|
</div>
|
data/config/routes.rb
CHANGED
data/lib/templates/engine.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module Templates
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
-
|
3
|
+
initializer 'templates', before: :load_config_initializers do
|
4
|
+
Rails.application.routes.append do
|
5
|
+
mount Templates::Engine => '/templates' if Rails.env.development?
|
6
|
+
end
|
7
|
+
end
|
4
8
|
|
5
9
|
initializer 'templates.assets.precompile' do |app|
|
6
|
-
app.config.assets.precompile += %w( application.css )
|
10
|
+
app.config.assets.precompile += %w( templates/application.css )
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
data/lib/templates/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: templates-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukasz Czapiewski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,11 +38,11 @@ files:
|
|
38
38
|
- Rakefile
|
39
39
|
- app/assets/config/templates_manifest.js
|
40
40
|
- app/assets/stylesheets/templates/application.css
|
41
|
-
- app/controllers/
|
41
|
+
- app/controllers/templates_controller.rb
|
42
42
|
- app/views/layouts/templates/index.html.erb
|
43
43
|
- app/views/layouts/templates/show.html.erb
|
44
|
-
- app/views/templates/
|
45
|
-
- app/views/templates/
|
44
|
+
- app/views/templates/index.html.erb
|
45
|
+
- app/views/templates/nested_index.html.erb
|
46
46
|
- config/routes.rb
|
47
47
|
- lib/install/templates.rb
|
48
48
|
- lib/tasks/templates_tasks.rake
|